Memory Leak when unloading world.

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • Environment:

      Windows 8.1/Centos 6.5

      Recently I've been dealing with severe memory leaks that simply did not appear to be affected by any plugin in particular and I managed to resolve the leaks by using reflection. Here is a gist of the code that resolved the memory leaks: https://gist.github.com/Favorlock/66bfa026f30e410f904b

      Worlds are never removed from the static map in BlockRedstoneTorch and BlockCommandSender are never removed from plugin manager permSubs and defSubs mappings. I've only ever noticed these leaks happening when the map contains command blocks, although this may apply to more than just command blocks for the BlockRedstoneTorch leak.

      Both the CraftingManager and EnchantmentManager also contain leaks. If the a world is unloaded and the lastCraftView is in that world then it leads to memory leak until such a time that lastCraftView is replaced with a new view. EnchantingManager leaks are caused by EnchantmentModifierProtection class's DamageSource field, EnchantmentModifierThorns class's EntityLiving and Entity fields, and likewise for EnchantmentModifierArthropods.

      Players/Entities are leak when the lastDamageEvent contains an entity from the world unloaded. Pretty noticeable with minigames.

      As far as chunks go I'm not certain where the memory leak exists, however, by commenting out that part of the code the WorldServer became a strong reference again, but with that processing enabled the WorldServer object became unreachable in YourKit and was garbage collected as expected.

            Assignee:
            Unassigned
            Reporter:
            Evan Lindsay
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: