"Cannot allocate memory"

Discussion in 'Bukkit Help' started by Hankscorpiouk, Jan 11, 2012.

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

    Hankscorpiouk

    Hi, I'm wondering if someone could help me with this....

    When I start the server using

    "screen -dmS MinecraftCraftBukkit java -Xms1024M -Xmx1024M -jar craftbukkit.jar nogui"

    I keep getting this:

    java.io.IOException: Cannot run program "sh": java.io.IOException: error=12, Cannot allocate memory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
    at java.lang.Runtime.exec(Runtime.java:610)
    at java.lang.Runtime.exec(Runtime.java:483)
    at jline.UnixTerminal.exec(UnixTerminal.java:297)
    at jline.UnixTerminal.exec(UnixTerminal.java:282)
    at jline.UnixTerminal.stty(UnixTerminal.java:273)
    at jline.UnixTerminal.initializeTerminal(UnixTerminal.java:77)
    at jline.Terminal.setupTerminal(Terminal.java:75)
    at jline.Terminal.getTerminal(Terminal.java:26)
    at jline.ConsoleReader.<init>(ConsoleReader.java:191)
    at jline.ConsoleReader.<init>(ConsoleReader.java:186)
    at jline.ConsoleReader.<init>(ConsoleReader.java:174)
    at net.minecraft.server.MinecraftServer.<init>(MinecraftServer.java:84)
    at net.minecraft.server.MinecraftServer.main(MinecraftServer.java:576)
    at org.bukkit.craftbukkit.Main.main(Main.java:134)
    Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
    at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)


    and in general we're getting several crashes a day that seem to be related to a lack of memory.

    These are the plugins we've got so far-

    ChestShop
    Essentials
    LWC
    MagicCarpet
    PermissionsEx
    Questioner
    RocketBoots
    Towny
    WorldGuard
    ColoredSigns
    Register-1.5
    WorldEdit
    CommandHelper

    My VPS claims we have 2GB of RAM available to us, also using /gc in game and looking at their resources screen seems to confirm there's plenty of memory available.

    I've tried googling around for solutions, but not finding anything very helpful so far.

    Any ideas?

    Many thanks.
     
  2. Offline

    Tylerjd

    First, get rid of the -Xms1024M in the command start. There is no need for it.

    Second I'm guessing you are on Linux? Run free -m in terminal and post the results. free -m shows the memory stats.
     
    Hankscorpiouk likes this.
  3. Offline

    Hankscorpiouk

    Hi, I've removed the -xms part but it's still doing it. Yep Linux, the VPS is running the 64-bit CentOS 5.

    I've heard a few people suggest the problem is OpenJDK and that using Sun Java will resolve the problem, but it doesn't seem to help here. Perhaps I'm not installing it properly, not sure....



    I tried free -m before starting the server and I get this-


    total used free shared buffers cached
    Mem: 2048 211 1836 0 0 0
    -/+ buffers/cache: 211 1836
    Swap: 0 0 0




    After starting it and Ctrl-A-D'ing back to the command line with the server running in the background I get this-

    total used free shared buffers cached
    Mem: 2048 1603 444 0 0 0
    -/+ buffers/cache: 1603 444
    Swap: 0 0 0
     
  4. Offline

    Tylerjd

    You should try installing Oracle Sun Java 7 JDK. It works better then OpenJDK for craftbukkit.

    And I would like you to answer the other two questions, as that could have some impact on things.
     
    Hankscorpiouk likes this.
  5. Offline

    Hankscorpiouk


    Sorry what were the 2 other questions?

    I'll try Sun Java again.


    Thank you so much, this seems to have fixed it :))

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

    Tylerjd

    Your welcome, and apparently I was thinking of another thread I posted. Sorry 'bout that. Glad installing Sun Java helped.
     
    Hankscorpiouk likes this.
Thread Status:
Not open for further replies.

Share This Page