MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / FreeMemory

Method FreeMemory

Source/Engine/AI/BehaviorKnowledge.cpp:167–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167void BehaviorKnowledge::FreeMemory()
168{
169 if (Memory)
170 {
171 // Release any outstanding nodes state and memory
172 ASSERT_LOW_LAYER(Tree);
173 BehaviorUpdateContext context;
174 context.Behavior = Behavior;
175 context.Knowledge = this;
176 context.Memory = Memory;
177 context.RelevantNodes = &RelevantNodes;
178 context.DeltaTime = 0.0f;
179 context.Time = 0.0f;
180 for (const auto& node : Tree->Graph.Nodes)
181 {
182 if (node.Instance && node.Instance->_executionIndex != -1 && RelevantNodes[node.Instance->_executionIndex])
183 node.Instance->ReleaseState(context);
184 }
185 Allocator::Free(Memory);
186 Memory = nullptr;
187 }
188 RelevantNodes.Clear();
189 Blackboard.DeleteValue();
190 for (Variant& goal : Goals)
191 goal.DeleteValue();
192 Goals.Resize(0);
193 Tree = nullptr;
194}
195
196bool BehaviorKnowledge::Get(const StringAnsiView& path, Variant& value) const
197{

Callers 2

StopLogicMethod · 0.45
ResetLogicMethod · 0.45

Calls 5

ReleaseStateMethod · 0.80
DeleteValueMethod · 0.80
FreeFunction · 0.50
ClearMethod · 0.45
ResizeMethod · 0.45

Tested by

no test coverage detected