Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to limit Minecraft to a certain amount of memory. To that end, I start it from a batch file with the following line:

javaw -Xms256M -Xmx256M -cp Minecraft.exe net.minecraft.LauncherFrame

but it routinely goes over 800 MB.

I also tried going to the Java applet in the Control Panel. Then to Java tab/View..., then added the following runtime parameter:


That didn't help either.

What can I do to limit a java process (or at least Minecraft in particular) to 256 MB of RAM.

share|improve this question
It may be that running minecraft just requires more than your allocating it. I know from experience, though under linux, java will eat mem esp if you dont give it enough to start out with. Should throw an exception when its out of heap, but that doesnt always happen – madmaze Sep 19 '11 at 5:17
up vote 3 down vote accepted

-Xmx only constrains the Java heap. The code itself, the JVM, OS DLLs, internal Java data structures and thread stacks all take additional memory. In your case, they apparently take more than 550 MB of RAM. No heap setting would bring the total under 256 MB.

However, note that the code parts may be shared across processes. A DLL that uses 5 MB of RAM in your process will generally use the same 5MB of RAM in another process.

share|improve this answer

You must log in to answer this question.

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