Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-185263

Non full chunks in cache memory "semi-leak"


    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.18 Pre-release 3
    • 1.15.2, 1.16.2, 1.16.3, 1.16.4 Pre-release 1, 20w46a, 20w49a
    • None
    • Plausible
    • Performance
    • Normal

      See patch: https://github.com/PaperMC/Paper/commit/cf82dad399cf3bfb6b4cdd54f264d4563633940e


      For any full status chunk on disk that is loaded, a lambda is created in loadChunks to load the Entity data from the NBT once it reaches full.


      This lambda is holding a reference to every variable in this functions scope, including the full chunks NBT compound...

      So for every chunk we load into the cache but never reach full status, this scope is leaked and holds a lot of memory.

      The Lambda needs to be created outside of the functions scope, as well as make a new NBT Tag compound and copy the Entities and TileEntities sections to it, so the only NBT that is "held" in a non full status is those 2 NBTTagList's.

      Or ideally, extract the NBT state out at this point of time in a safe way so no NBTTagCompound's have to linger.

            boq [Mojang] Bartosz Bok
            aikar Aikar
            16 Vote for this issue
            9 Start watching this issue