justinhj/astar-algorithm-cpp

stlastar.h:661: EnsureMenoryFreed: Assertion `m_AllocateNodeCount == 0' failed.

etorth opened this issue · 1 comments

I recently always get this assertion failure.
I checked and seems the m_AllocateNodeCount fails with value -2
Do you have any suggestions? Thanks!

Update:
I think I have located where is the cause: I called FreeSolutionNodes() when I didn't get a solution...
This frees m_Start and m_Goal, with decreasing the m_AllocateNodeCount to -2.

But anyway m_Start/m_Goal is allocated by AllocateNode()
Shouldn't we free it? Thanks!

Hi, wasn't able to replicate this problem. By changing the findpath example to one that does not find a path all memory was freed. Check in your code whether you are following the same allocation pattern. You don't have to call AllocateNode yourself, you just pass the start and end states to SetStartAndGoalStates and the m_Start and m_Goal is allocated there, and should be freed later.