Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5278

Probably memory leak from Drowned, indirectly also appearing to leak EntityPlayer instances


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Tested on Windows 10

    • This server is running CraftBukkit version git-Spigot-798ea6a-2012f1e (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)
    • No plugins were on the server
    • Yes

      Tested in Spigot 1.13.2 (final build) and the mentioned 1.14.4 version


      What I'm doing for my test:

      Create a 1x1 lava pit on a clean Spigot 1.14.4 or 1.13.2 final build, no plugins used.

      I used a macro, but you can also do it manually, but spawn X amount of chickens and X amount of drowneds in the pit. I personally tested it several times with somewhere between 1000-2000 mobs, but the bug also occurs when you take for example just 5. After a few seconds, all should have died and be removed from memory.

      What I expect to happen:

      Both chicken and drowneds, after having been killed, should be removed from memory, as they're dead/invalid. There should be 0 Drowneds and 0 Chickens in memory.


      What actually happens:
      After doing this experiment where you spawned X Drowneds and X of another mob kind, when you take a heap dump, X amount (or sometimes a bit less) are still reference in the memory, while for the Chicken, they are actually properly removed from memory. I tried logging in/out a few times, moving to other chunks and several other things, but for some reason the Drowned stay in memory.


      Is this intended behavior? Or why are those drowned kept in memory? Maybe I'm missing something, but as far as I could find, it appears to be some kind of memory leak.


      Update 1: I did another experiment on Spigot without plugins, once again couldn't test on vanilla though:
      Spawn like 10 drowneds into the lava pit, quickly logout, login again
      Repeat several times. Every EntityPlayer instance is kept in memory, as far as I could find that's because the Drowned keeps a reference to them.

            Unassigned Unassigned
            KoekenMeneer KoekenMeneer
            0 Vote for this issue
            2 Start watching this issue