Solution for bad java memory managment?

Discussion in 'Spigot Help' started by FreeKillGR, Jan 7, 2020.

  1. So my problem is that no matter what I try sooner or later my server will run out of memory and crash I really don't understand why minecraft/java works that way.

    I have been trying to find a solution to this for ages but nothing I have found so far worked, is there really no way to fix this?

    How do huge servers with 1000+ players work around these issues I have never seen them restart or something like that.

    Some posts that talk about this but have found no solution to my understanding:

    And I have also tried the flags from and it just took longer for the server to crash but after some stress testing, it did.
  2. What do you mean by your server will run out of memory?
    Increase Max Memory... (-Xmx flag)
    Otherwise there's probably something causing a memory leak.
    • Agree Agree x 1
  3. Well I don't have unlimited memory I have set my Xmx to 6gb (it should be enough for a 1.15.1 faction server with 2 players)

    The problem is that my memory usage will keep increasing until the server crashes (mainly when I load chunks) it just never frees up even when the players disconnect the ram will stay fully loaded, I just don't understand how an empty server with 50 plugins can take 6 GB of ram.
  4. you have reached a point where your server is facing a memory leak, although I'm not that sure how memory leaks work, I'm sure it's something with the plugins, you may want to remove all plugins and see whether its still a problem,

    (Now, I know if you have stuff like NPCs or Holograms, removing the related plugins with break the stuff, if its just commands, remove those plugins, anything that you can see such as display NPCs or Holograms that may run commands, all those don't remove.)
  5. What plugins are you using?
  6. DavidDevelops


    As stated before, Its a memory leak, Probably (Most likely unless you are running a custom spigot) a plugin, List them along with when this problem started (If you know what plugin you added when it started even better! Even if its a few plugins the smaller the list the easier)
    A memory leak is when something i using memory and when it's finished not clearing it, Therefore keeping the data (And the memory locked) until a restart happens and it clears ALL the memory,

    Side note: Big servers/networks do restart QUITE often, Not only due to that but its good to restart every once and awhile for reasons I'm not going to go into, How they do this is they have backup hubs and such or more hubs in general, and big faction servers like yours (Saico, TheArchon, Etc) do restart (I have witnessed many) just only once every 2-3 days