• Post Reply Bookmark Topic Watch Topic
  • New Topic

memory arguments

 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!