Hi,
I'd want to restrict the maximum heap size for a Java application but it doesn't seem to work. I'm running the application from a jar package through bat in Windows. Bat contents:
@Echo off
set CLASSPATH=.
java -Xmx32m -classpath %CLASSPATH% -jar MyApplication.jar
This should restrict the maximum heap size of 32 megabytes. However, when I do things consuming memory with the application, the Windows Task Manager shows that the memory consumption goes at least to about 70 megabytes... I even tried with -Xmx2m but that didn't make any difference.
So, I'm not totally sure what's the problem. There is of course stack etc contained in the memory usage but the memory used by the program should be mostly heap space...
Java version seems to be 1.6.0_14.
For those interested what I'm after, I'm trying to see how my application would behave with certain functions when it runs out of heap space.
EDIT: Hmm.. I was surprised that the heap usage was limited to the 32M actually when monitoring with JConsole. Gotta get more memory used...
Thanks for ideas, Touko