Memory Leak [Need Advice]

Discussion in 'Bukkit Help' started by TheBeast808, Aug 18, 2011.

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

    TheBeast808

    I believe my server has a memory link, and I don't know how to locate the leak. I'm running Ubuntu. How would I go about finding it?

    Also, some additional information encase anybody already knows some sources of memory leaks:

    Output of /pl:
    Startup script:
    Graphs of memory usage(timeline = 1 day):
    [​IMG]
    [​IMG]


    Thank you to anybody who helps.[/QUOTE]
     
  2. Offline

    Brain

  3. Offline

    TheBeast808

    I read through that, but it didn't help much.
    Cached/Buffer both says 0, which I assume means that no memory is being used for it.
    I also never had a 880mb limit previously, so I see no reason it would suddenly start.
    Finally, java says it's using 3.6gb under the VIRT column and 1.8gb under the RES column in top. Bukkit has never had to use this much before, as the numbers used to be fairly close together.
     
  4. Offline

    Jadedwolf

    I'm waiting for the day when we can see exactly how much memory and resources each plugin uses.
    It will be a glorious day.
     
  5. Offline

    Brain

    Wow, this looks serious. Problem is you can't look inside the Java VM just like that. I wrote a micro-plugin for myself that defines a /mem command which shows relevant VM memory statistics and attempts to run a garbage collection. I attached it to this post. It's built against cb860, but should still work with later versions.

    Short and very superficial explanation about Java memory allocation:
    The Java VM gets a maximum amount of RAM that it may use. This can't be exceeded, Java crashes/exits if it does. -Xmx sets this limit. -Xms sets the initial amount of RAM the Java VM will occupy. Inside this chunk of allocated memory is where things happen. Java doesn't release memory per se, it periodically checks for stuff that nobody uses anymore and throws it away (garbage collection). That's why the amount of memory used is climbing slowly until it reaches a certain point and then rapidly drops. Inside the Java VM there are lots of fancy algorithms that decide when a garbage collection should occur, how thorough it should be and whether or not it is better performance-wise to just use a little bit more memory.
    And this is why you will see something like this:
    Memory allocated: 384MB of 2044MB​
    Memory actually being used: 339MB​
    If "memory allocated" were somewhere around 2000MB and "memory being used" staying in the general area too then somewhere something inside your program is hogging memory. Usually by holding a reference to an object that is not in use anymore because someone forgot to have that last reference removed.

    Apart from Minecraft there might be something else that eats up RAM. Since your memory usage exceeds 5GB and cache and buffers go to 0 it can't only be Java that is eating up everything.
     

    Attached Files:

  6. Offline

    Tomab

    You might try removing the TKeepGrowing plugin and see if that solves your problem. Please let me know if you try this and if it has any affect.
     
  7. Offline

    M1sT3rM4n

    Indeed. It will also help a lot if Notch fixes MC's goddamn memory leaks.
     
Thread Status:
Not open for further replies.

Share This Page