justinhj/astar-algorithm-cpp

IndexOutOfRangeException: FATAL - HexGrid has run out of preallocated MapSearchNodes! 80000>= 80000

tangeping opened this issue · 3 comments

    // Fixed sizes for collections
    readonly int kPreallocatedNodes = 80000;
    readonly int kPreallocatedMapSearchNodes = 80000;

I fixed the number of this, it's still have an error of “FATAL - HexGrid has run out of preallocated MapSearchNodes”。 what's wrong of it?

Hi Tangeping
Is it possible your implementation is creating new nodes unbounded? You will eventually run out of free nodes if you do that.

Hi justinhj
Thank you for your answer,I read your code, but it show me that it will loop step until find a successful path . and then the free nodes are constantly used. the map array is 160 * 160. it need add neighbor nodes , the worst result need 160 *160 * 8 = 204800 size array, it is too big too slowly, Do you have any better suggestions?

do { searchState = pathfinder.SearchStep(); searchSteps++; } while (searchState == AStarPathfinder.SearchState.Searching);

No, there's no way to handle large maps without changing your data structure.