Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.