aspose file tools
The moose likes Performance and the fly likes memory arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Performance
Reply Bookmark "memory arguments" Watch "memory arguments" New topic
Author

memory arguments

Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
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
-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.
 
IntelliJ Java IDE
 
subject: memory arguments
 
Threads others viewed
swap method
What hardware do you use ?
jvm size
java process memory and heap size
how outofMemoryError canbe avoided
MyEclipse, The Clear Choice