Support Forum

Memory leak, how to reset?

I’m having a very specific case and my game is basically a simulation that need to run for hours
I’m using a Recast Graph, and some prefabs spawns every minutes and require a local compute of the graph via GraphUpdateScene component

However, the memory usage is getting bigger and bigger, I’ve profiled and seems that Pathfinding.Graphnodes was growing really fast.
I’ve tried to reload the scene every 30 minutes hoping that the some stuff would be garbage collected, it helped a bit but there is still a leak (approx 500mb/hour)

Is there any way to clean the memory or reset entirely the graph?

Thank you

1 Like

Same issue, after scene reload memory is not getting released and every time game grabs ~500mb more in our game


Which version of the package are you using?

I’m using version 4.2.15, I think it’s the current one


Sorry for the late reply.
What you could try is to use the beta version available here: In the beta version the recast graph has been significantly rewritten and it’s very likely that this issue has been resolved there as well.


I’ve tried the beta, and the problem is still there.
The number nodes of the navmesh/pathfinding keep growing and growing, the more I update the graph. And reseting the scene doesn’t flush them away.

I’m currently running some memory profiler test to try to give a more precise idea of where the leak comes from.
Otherwise, what could I do on my side to clean them properly, or force a full recompute ?
I’ll try to dig into the RemoveGraph method to force it, but I’m quite sure the persistent data after scene change is not meant to be there.

Thank you


I have not been able to replicate this.
Would it be possible for you to share a simple example project which shows the issue?