When running a java class with the following command : java -ms32m -mx64m ........ what exactly do these mean? I understand them to be setting max heap usage to 32MB (or 64MB). When running JProbe with an application that uses these arguments, I noticed that the garbage collector gets kicked off every time memory usage reached 32MB. The 64MB doesn't seem to mean anything. Any explanations out there...? Thanks. Paul
Dave Landers
Ranch Hand
Joined: Jul 24, 2002
Posts: 401
posted
0
-Xms is the initial setting for heap size. Its what the JVM allocates when it starts up. -Xmx is the setting for maximum heap size. If the JVM needs to run over the current heap size, it will increase it till it gets to this limit. If you have lots of objects in active use (that the GC can't reclaim) and you need more - you will get an OutOfMemory exception when the VM hits the mx limit. As to how the GC works, that is another issue altogether (it changes somewhat from version to version and hotspot even has a client and server mode that differ, etc). But I imagine that the JVM you are looking at is tuned to believe that GC is cheaper than reallocating the heap. So it is trying that first - apparantly it is successful in reclaiming memory because you don't see the realloc.