Solved Allocating only memory needed?

Discussion in 'Bukkit Help' started by DIscoCat42, Jan 6, 2013.

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

    DIscoCat42

    Is there a way to let the server decides how much memory it wants/needs to allocate? I run my own server using a java command ( java -Xms1500M -Xmx1500M -jar craftbukkit.jar). I only have two gigs on my VPS at the moment, but the lag is just terrible when allocate the same as the max. I also tried running it with java (-Xms500M -Xmx1500M -jar craftbukkit.jar) and that seems to try and force the server to stay at 500M. Is there anyway to do this? Iv'e heard you can set up a minecraft.sh script, but the last time I tried it it didn't work too well. Any information would be greatly appreciated.

    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 8, 2016
  2. Offline

    Milkywayz

    -Xincgc
     
  3. Offline

    DIscoCat42

    Milkywayz

    I'm sorry? I'm still pretty new to the bukkit things.
     
  4. Offline

    Milkywayz

    My server start up script:

    Code:
    java -Xincgc -Xmx6g -server -jar craftbukkit.jar
    • -Xincgc = Basically allocates as much as ram as you need, it increases as you use more
    • -Xmx6g = Sets the max memory, for me I chose 6g even though I could use like 12
    For you i'd just change -Xmx6g to like -Xmx1800m.
    My essentials /gc output:
    Current TPS = 20.0
    Maximum memory: 6,077 MB
    Allocated memory: 589 MB
    Free memory: 252 MB
    This is with 8 players, 4 total worlds, and 24 plugins.
     
  5. Offline

    DIscoCat42

    Oh, thanks!

    Ah wait, i'm getting this now,

    Error occurred during initialization of VM
    Could not reserve enough space for heap offset array

    When I do this ::: java -Xincgc -Xmx1800M -server -jar craftbukkit.jar :::

    And when I do this, ::: java -Xincgc -Xmx1800M -jar craftbukkit.jar ::: I get this

    Error occurred during initialization of VM
    Could not reserve enough space for heap offset array

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 8, 2016
  6. Offline

    Milkywayz

    DIscoCat42 Then you probably don't even have 1.8g despite your host advertising you have 2gb. Try 1500m
     
  7. Offline

    DIscoCat42

    Ah, ill have to talk to them about that, I did 1500M and it opened, thanks for that. Now it's working.
     
  8. Offline

    Milkywayz

    I'f I am not mistaken, a VPS has the os to run too which uses some ram so your actual usable ram is lowered then they say.
     
  9. Offline

    DIscoCat42

    Ah, I see, its strange though, our previous host let us run at 1800M with no problems, we are using the same OS now that I was before, so i'm not entirely sure why that's not working.
     
  10. Offline

    Zorcof

    I have the same issue , i run my server on a dedy which has 16gb of ram ,

    when i run java 32bit i can only run it with 1536mb of memory & when i run it using java 64bit i get the same error as you DIscoCat42 , but if i run a vanilla server i can use java 32bit or 64bit & allocate up to 8gb with no errors ,,,
    can someone help me with this plz?
     
  11. Offline

    bigyiin

    Your host is not the problem. in your run.bat you are specifying a maximum and minimum heap size. and not giving any consideration for the new gen memory requirement. recommended setting is 3/8 that of your max heap. but because you didnt bother to specify the new gen java will use a default value. best case senario it knows to use 3/8 of the max heap automatically. meaning when your setting 1800mb you can add at least 675mb woops your way over your 2gig at 2475mb
    now bearing in mind that this 2475mb is ram which you are specifying is available for use by the Java virtual machine to run tasks. what about the java virtual machine its self it needs so ram too right? and of course the operating system ram needs to be considered. Dont want to go on too much but im sure you see where the problem is now. oh um yeah -Xincgc refers to garbage collection. java uses garbage collection to clear old shit out your ram that the application dont need to use any more if your going to set your min and max heap sizes the same you basically just disabled garbage collection. also garbage collection is far more efficient ie less resource intensive for same effect when it clears the garbage from the new gen before it even reaches the old gen aka the heap so if anything its the size of your new gen that needs increasing to reduce the use of the heap. incidentally increasing new gen size means your min max heap must also be increased lol
     
Thread Status:
Not open for further replies.

Share This Page