My server use more and more ram

Discussion in 'Spigot Help' started by Plakivado, Apr 26, 2017.

  1. Hello

    My server use more and more ram over time.
    It start with only 3 giga of ram, and it increases over time.

    After a few hours, it ascends to 4 giga, and 5 giga ...

    And after a day, it ascends to 8 giga, my maximum :(

    And after a moment, my server crash :(

    Does anyone have any idea, please ?
  2. Maybe because you use too many plugins or something?
  3. ah, it's because I have too many plugins ?
    So, if I have too many plugins, my ram ascends more and more without any limit ?
    And until a certain level of number of plugins, it won't do that ?

    I find that very strange, and I don't understand the logic
  4. Well, you're stating that your server uses more and more RAM over time. Y'know what's thats called?

  5. yes, thank you, I had thinked about that, but I was full of doubt

    So, can you say me where is that memory leaks and how I can stop it ?
    Is it from a plugin ?
  6. Well, to start: A memory leak is when a plugin starts saving data in it's RAM without ever cleaning it up. That's an quick and easy way of explaining it roughly. There is most likely a plugin in your server that does this, which means that it is poorly programmed. You'll have to find out which one.

    Now I'm not entirely sure how you're gonna find out which plugin causes it. I don't think a timings report displays RAM usage...
  7. Probably yes.
  8. electronicboy

    IRC Staff

    It's most likely from a plugin, yes; How you detect it is dependent on your access to the machine and your knowledge of java, if you're on a shared host, only real way to tell is to remove plugins one by one until the issue is rectified.
    The only real alternative, that won't work if you're on a shared host, is to take a memory dump and analyse that; However, if you don't understand much about java or the JVM itself, you're only likely to confuse yourself even more, as opposed to actually finding the issue

    You also have to be weary that your crash isn't caused because you've allocated too much memory for the JVM, so the specifics of this are really dependent on what exactly the crash says. An issue allocating ram is generally a different issue than say, an out of memory exception being thrown because you've ran out of heap space
  9. Ok, thank you
    So I thnik that I should test without one by one plugin ...
  10. ok, thank you
    euh, I have a windows VPS (I don't know if it's " shared host ", or if I can " take a memory dump " )

    euh, my vps have 8 giga, and I have allocated 8 giga to my spigot server
  11. Allocate 6GB RAM to your spigot server to see if it lags. Your VPS needs always some GB spare to allocate it's own stuff.
  12. ah, ok, thank you
    or I can allocate 7 GB ?
  13. Keep it at 6 to play safe
  14. electronicboy

    IRC Staff

    Well, if you're allocating 8GB of ram to your MC server, and you only have 8GB of ram, you're going to run out of memory. Allocating 6GB to MC should fix your issue, Java needs memory not only for the heap, but also memory for itself, so you end up using more than the memory you allocate to MC; As well as the fact that your server requires free ram in order to function.

    Memory allocation to Java is also something that can increase over time due to how GC works
  15. ok, thank you

    ah, so maybe the increase overtime of used ram isn't because of plugin ?
    (But only because of the allocation of all the ram ?)
  16. You're using Windows, that explains it :D

    But no seriously, there's a reason 95+% of the servers are Linux and not Windows.
  17. ^^

    Yes, I know that linux is more powerfull, I already had a lot of minecraft serveur on linux, but I still prefer Windows, because it's more simple, and I have a graphic interface

    ( And I always have a lot of problems, with linux ... )
  18. electronicboy

    IRC Staff

    GC is a fickle of a subject, but it generally boils down to: if you allocate so much ram to java, it's going to use it;

    there is always a chance that a memory leak is what is causing memory usage to increase, but there is also a much higher chance that GC is just not being able to free as much memory for some reason (e.g. GC isn't cleaning out memory fast enough and so heap expansion is occurring).
    I honestly suggest at the least adding -XX:+UseG1GC to your launch paramaters (just after you allocate memory, e.g. -Xmx...G -XX:+UseG1GC ) in order to use G1GC, which is much more suited for MCs high short lived object allocation rate, as well as ensuring that you set Xms to be equal to Xmx, so that your heap is already at the maximum size it should ever really get to (However, that will NOT stop the JVM itself needing more memory).
  19. Can you say me what is "GC" please ?