Just back to the original issue, setting the system not to pool paths solved the memory leaks I was having. The problem is that some of our agent objects are remaining in memory after a scene change because they are been referenced by a path in the pool.
Maybe I'm barking up the wrong tree, but the memory profiler shows that the PathPool is keeping the reference alive.
OnPathDelegate has a reference to the Seeker.
In the agent's onDestroy function, I try to ensure the seeker is cleared but it doesn't appear to be working.
_seeker.pathCallback = null;
_seeker = null;
This is how I request a path:
RandomPath randomPath = RandomPath.Construct(startPosition, 10000, null);
protected virtual void OnPathSearchComplete(Path path)
// Claim the path
// Release the path
The memory leak isn't happening for all agents, so I'm guessing that it only happens if an agent was in the process of requesting a path when the scene changed. Can you see anything that I am doing incorrectly?