4

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:

-Xmx256m

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.

1
  • 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
    Commented Sep 19, 2011 at 5:17

1 Answer 1

4

-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.

You must log in to answer this question.

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