VMFlags
When it comes to garbage collector and memory flags VMs from different vendors differ somewhat. Most flags aren't even properly documented by the usage printout of the VM themselves. This page tries to shine some light on what garbage collection related flags there are and what they are good for. It covers several Sun and IBM JVMs
Sun JVMs
Disclaimer: Please note that the data presented in this document has been gathered from several publicly available sources. It is a conscious selection of available VM parameters and even though we tried to check most of the facts presented this document may contain errors.
Choosing a VM
-server
Instructs the VM to use the server HotSpot VM. This also implies that default heap sizes and permanent generation sizes are different.
Under 1.5 this option is the default option, if the machine is a server-class machine.
Supported by: 1.3, 1.4, 1.5
-client
Instructs the VM to use the client HotSpot VM. This also implies that default heap sizes and permanent generation sizes are different.
Supported by: 1.3, 1.4, 1.5
Printing Information about GC
-verbose:gc
Prints out information about garbage collections to standard out. To print the same information to a file, use -Xloggc:
Example:
[GC 325407K->83000K(776768K), 0.2300771 secs]
[GC 325816K->83372K(776768K), 0.2454258 secs]
[Full GC 267628K->83769K(776768K), 1.8479984 secs]
See -Xloggc
Supported by: 1.3, 1.4, 1.5
-Xloggc:
Prints information about garbage collections to the specified file.
In conjunction with -XX:+PrintGCDetails this is the best setting for the free GCViewer.
Supported by: 1.4, 1.5
-XX:+PrintGCDetails
Instructs the VM to be more verbose when printing out garbage collecion data. Specifically it does not only tell you that there was a collection, but also what impact it had on the different generations.
This flag is very useful when tuning generation sizes.
In conjunction with -Xloggc this is the best setting for the free GCViewer.
Example:
2.459: [GC 2.459: [DefNew: 3967K->0K(4032K), 0.0141600 secs] 8559K->7454K(16320K), 0.0143588 secs]
Supported by: 1.4, 1.5