Support Forum

OutOfMemoryException on Editor with 2 16x16 graph maps

OutOfMemoryException: Out of memory
  at (wrapper managed-to-native) System.Object.__icall_wrapper_ves_icall_array_new_specific(intptr,int)
  at System.Collections.Generic.List`1[T].set_Capacity (System.Int32 value) [0x00021] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.Collections.Generic.List`1[T].EnsureCapacity (System.Int32 min) [0x00036] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.Collections.Generic.List`1[T].Add (T item) [0x00010] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at Pathfinding.GraphUtilities.GetContours (Pathfinding.GridGraph grid, System.Action`1[T] callback, System.Single yMergeThreshold, Pathfinding.GridNodeBase[] nodes) [0x00303] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/Core/Misc/GraphUtilities.cs:220 
  at Pathfinding.RVO.RVONavmesh.AddGraphObstacles (Pathfinding.RVO.Simulator sim, Pathfinding.GridGraph grid) [0x00051] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/RVO/RVONavmesh.cs:97 
  at Pathfinding.RVO.RVONavmesh.OnLatePostScan () [0x000ef] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/RVO/RVONavmesh.cs:72 
  at Pathfinding.RVO.RVONavmesh.OnGraphsPostUpdate () [0x00001] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/RVO/RVONavmesh.cs:46 
  at Pathfinding.GraphModifier.TriggerEvent (Pathfinding.GraphModifier+EventType type) [0x000ed] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/Core/Misc/GraphModifier.cs:80 
  at Pathfinding.GraphUpdateProcessor.ProcessGraphUpdates (System.Boolean force) [0x00070] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/Core/Misc/GraphUpdateProcessor.cs:186 
  at Pathfinding.WorkItemProcessor.ProcessWorkItems (System.Boolean force) [0x0012a] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/Core/Misc/WorkItemProcessor.cs:307 
  at AstarPath.PerformBlockingActions (System.Boolean force) [0x0003e] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/Core/AstarPath.cs:881 
  at AstarPath.Update () [0x00029] in /Users/juan/Unity/City/Assets/AstarPathfindingProject/Core/AstarPath.cs:864

Any idea why this is happening? it started happeing all of a sudden when adding/removing street tiles. This ones are tags in one graph grid that happen to be obstacles for ships using tags, and on another grid are simple nodes walkable or not walkable .

Hi

That’s very odd… This might have been fixed in the beta version though, I think there’s been a fix for the GetContours method there.
You could also remove the RVONavmesh script to work around this.

Hello again. After checking my code I saw something I was doing after destroy/build each tile:
AstarPath.active.UpdateGraphs(bcBounds);

I thought maybe calling this too many times could cause the memory exception. Then I removed it and this is what’s happening now, new built tiles after loading map are placed down. If I do a Scan of the graph it gets fixed.

Captura de pantalla 2021-04-30 a las 11.29.29

This is what I do after building the street:Captura de pantalla 2021-04-30 a las 11.30.12

And this is my graph config:

Should I have not removed the
AstarPath.active.UpdateGraphs(bcBounds); ?

Is this the cause this problem is happening?

still trying to solve this.
Please any ideas?

Hi

You probably should not have your node.Walkable = true line there. Only use UpdateGraphs for that. It will take care of updating everything properly.

Hey there, still polishing this. Testing again and realized I need the
node.Walkable = false in the RemoveStreet, but I can take out safely the node.Walkable = true from the AddStreet function as you suggested and seems to work fine.
Just wondering why did we do this and why it worked because I dont understand why was that a problem so I can remember next time.
THanks!

Hi again, sorry to bother you again but I’m still getting the exception:
Captura de pantalla 2021-05-13 a las 12.45.17

What could I do to trace better the reason of this ? Is there some kind of inner log I could provide you?

This seems to be the part is crashing now:
Captura de pantalla 2021-05-13 a las 12.56.34

On the last try there were 2 tiles to tag, on the second got stuck.