We have identified a memory leak in Minecraft's Pathfinding System.
In MCP Naming, the NodeProcessor class (PathfinderAbstract in mc-dev naming) is the culprit.
First parameter is IBlockAccess, which is set by the first method in the class. This parameter is set to an instance of a Chunk Cache.
However, the 2nd method called postProcess in MCP, never cleans up this reference.
This causes an Entity's Pathfinding instances to hold onto a reference of a ChunkCache.
This ChunkCache then holds references to many Chunks, even after they unload.
These unloaded chunks then hold references to other leaked Entity objects, who also have references to Pathfinders...
This leaks to potential to create a chain of leaked objects.
Attachments
Comments 11
Interesting. I've yet to try your patch, and to see if it just works for you or if it works for both of us.
Is this the cause of MC-94438?
I don't believe so, as this memory leak also affects 1.8.
I wonder if MC-94438 has to do with Grass blocks triggering Chunk Loads for Light Level checks.
As that is another flaw we've recently found.
My quick bandaid for that in paper is to return 0 for unloaded chunks light level... Which should only ever happen for blocks that gather light data from neighbor, and that would result in it using 1 of the other 3-4 neighbors.
Maybe thats good enough for Vanilla to do?
See MC-100341 for that.
My fix patch can be seen here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/CraftBukkit/commits/f92e01ba5cf