Solved Memory Leak

Discussion in 'Plugin Development' started by spy85, Feb 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    spy85

    I believe my plugin, in which is very large and unorganized is the cause of a memory leak. What kind of things can cause this in a plugin?
     
  2. Offline

    1Rogue

    Creating unnecessary instances, not returning heap objects to memory (which is what GC does) by keeping some form of reference to old object (phantom, weak, etc). Hard to tell without code.
     
  3. Offline

    xTrollxDudex

    spy85
    Cancelling mob spawns.
     
  4. Offline

    TeeePeee

    What 1Rogue said. Also it may not be a memory leak so much as a resource-intensive synchronous activity. Something like iterating through n-amounts of blocks, measuring dynamic distances or anything that takes a considerable time to run in any event that fires often (such as mob spawn, as TrollDude mentioned) will cause some TPS drop.

    A for-instance of a memory leak is writing a reference of a plugin class to NMS heap-storage. As this cannot be garbage collected when your plugin disables, this causes a memory leak (and eventually a PermGenSpace error).

    A for-instance of a memory-intensive activity (but not a leak) is iterating through nearby blocks to ensure mobs only spawn within 20 blocks of a crafting table. Since this logic has to iterate through so many blocks (worst case 400 per spawn), it causes the code execution to slow down as it has to complete the check before moving on.
     
  5. Offline

    RawCode

    there are tons of heap analizers, why not running one and getting source of memory leak?
     
  6. Offline

    spy85

    My plugin is spawning loads of zombies at once with loops maybe if I added a short delay between these spawns this would help?

    I went through the entire plugin and every class and did a ton with the information you gave me so I will see how the server performs within the next few days. Thanks so much!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
Thread Status:
Not open for further replies.

Share This Page