2

I've looked at many different tutorials and Q&A websites, but I can't get it to work.

Right now Minecraft will only start if I have the -Xms1G JVM argument; if I try to increase it, I get the error:

Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap.

It sounds like either I don't have enough RAM available, or there's a program keeping Minecraft from taking up that much RAM. However, I have 8GB of RAM, so I have way more than enough.

Does anyone have any ideas on what's keeping me from increasing the amount?

5
  • I have had the same problem and I have 4 (3.9 Available) GB of RAM
    – Eisler 485
    May 1, 2015 at 0:28
  • 4
    Windows Mac Linux?? If its windows hit shift+control+escape and check to see what your Free RAM is.. Windows itself takes up quite a bit of RAM.. Just because your system has 8GB does not mean its actually all useable by a single application.
    – James
    May 1, 2015 at 1:12
  • I have Windows, and more than enough RAM available.
    – Tandorvir
    May 3, 2015 at 16:52
  • 1
    If you're using a 32 bit operating system you can't assign more than 1GB to java
    – imulsion
    May 3, 2015 at 20:48
  • 2097152KB is ~2 TERABYTES. I don't think you have that much RAM.
    – SF.
    May 27, 2019 at 9:59

2 Answers 2

7

If you are going to use JVM arguments to define the memory allocation, be sure that you are not providing duplicate commands.

-Xms1G will set the MINIMUM HEAP to 1GB at start-up.

-Xmx1G will set the MAXIMUM HEAP to 1GB at start-up.

Generally, when I need more memory for Minecraft, I set the max heap and not the min heap.

For example;

java -Xmx2G -jar minecraft.jar

you could also set it like this:

java -Xms1G -Xmx2G -jar minecraft.jar

Avoid allocating too much RAM since that will starve the rest of the machine.

3
  • Much more importantly, make sure that you actually set Xmx >= Xms! Not sure how Java would handle conflicting numbers, but better safe than unnecessarily rely on something some guy at Oracle (or Sun) put in the JVM code.
    – MrLemon
    May 1, 2015 at 8:16
  • @ianc1215, I tried the first set of arguments you gave: "java.exe -Xmx2G -jar minecraft.jar" I got the error: "Error: Could not find or load main class java.exe" I really don't know what's wrong. Any ideas, anyone?
    – Tandorvir
    May 3, 2015 at 16:47
  • minecraft. jar was just an example. you need to load the server jar file by its file name or put the arguments in the minecraft launcher for the client. May 4, 2015 at 0:01
2

Okay, apparently I was using the 32-bit version of Java. I installed the 64-bit version and everything's working now. Thanks for your answers and comments, everybody!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .