I would like to limit the maximum heap size for a Java application, but it does not seem to work. I am running an application from a jar package through bat on Windows. Bat Content:
@Echo off
set CLASSPATH=.
java -Xmx32m -classpath %CLASSPATH% -jar MyApplication.jar
This should limit the maximum heap size to 32 megabytes. However, when I do what consumes memory with the application, the Windows task manager shows that the memory consumption is at least about 70 megabytes ... I even tried to use -Xmx2m, but that did not matter.
So I'm not quite sure what the problem is. Of course, a stack, etc. Contained in memory usage, but the memory used by the program should be basically a heap place ...
The Java version looks like 1.6.0_14.
, , , , , .
EDIT: .. , 32M JConsole. ...
,