The standard Java HotSpot VM options are available with the Mac OS X Java VM. In addition to the standard options, many nonstandard (-X and -XX) options are also available. These, and notable exceptions, are listed here.
A Note About Values
General Options
Mac OS X-Specific
Heap Size
Garbage Collection: Memory Usage
Garbage Collection: General Settings
Compilation
Threading
Sharing
Except where specified, any time are specified as a parameter in an option, you may also designate kilobytes or megabytes by using the letter k or m respectively. (You may use either uppercase or lowercase letters.) For example, the following would all be equivalent values for bytes:4194301, 4096k, 4096K, 4m, and 4M.
-serverThere is not a distinct server VM for Mac OS X. Although you may use the -server flag when invoking java, it does not start up a different VM, instead it starts the client VM that has been tuned for use in a server environment. This tuning includes:
Using a different class list for the shared archive generation that does not include the GUI classes.
Increasing the size of the Java heap.
Increasing the size of the Eden generation.
Turns on thread local Eden garbage collection.
-XDisplays a brief description of the nonstandard VM options.
-Xbootclasspath:pathSpecifies a list of directories and JAR and ZIP archives to search for boot class files in. Separate multiple entries with colons (:).
-Xfuture Performs strict format-checking of class files. This option enforces a tighter conformance to the class file specification than the default, which is based on the standard in Java 1.1.x. You should test your code with this flag to ensure functionality in future versions of Java that may enforce stricter class file format-checking.
-XprofSends detailed profiling data of the running program to standard output. This option should not be used in production code.
-XrsSame as -XX:+ReduceSignalUsage.
-XX:MaxDirectMemorySize=size in megabytesThe maximum memory that can be allocated using NIO direct buffers. The default is 64 (64M).
-XX:-PrintJavaStackAtFatalStateBy default Java backtraces are generated when a crash occurs in native code. Turn this option off if you are seeing crashes in your Java error reporting.
-XX:+ReduceSignalUsageNormally, Java responds to SIGHUP, SIGINT, and SIGTERM signals. With this option, Java ignores these signals; you need to implement handlers for them in native code as appropriate. Also, implement any relevant shutdown procedure from System.exit().
-XX:ReservedCodeCacheSize=size in megabytesSets the maximum code cache size. The default is 32 (32M).
-Xdock:icon=pathToIconFileSets the icon displayed in the Dock. By default Mac OS X displays a generic Java icon unless you specify otherwise. You only need to use this for applications launched from the command line or from a JAR file. Double-clickable application bundles designate their icon in the Info.plist file.
-Xdock:name=applicationNameSets the name to display in the Dock and in the menu bar. By default Mac OS X displays the fully qualified name of the main class unless you specify otherwise. You need to use this only for applications launched from the command line or from a JAR file. Double-clickable application bundles get the appropriate name from the Info.plist file.
-XX:+UseFileLockingOff by default, this option enables Carbon file locking. If your Java application will be interacting with files that may be simultaneously acted on by Carbon applications, use this flag. It keeps the respective applications from modifying the file while the other is accessing it.
-Xmssize in bytesSets the initial size of the Java heap. The default size is 2097152 (2MB). The values must be a multiple of, and greater than, 1024 bytes (1KB). (The -server flag increases the default size to 32M.)
Note: Many of the garbage collection flags are dependent on the settings for the heap size. Make sure that you have the appropriate sizes set for the heap before fine-tuning how garbage collection uses that memory space.
-XX:MinHeapFreeRatio=percentage as a whole numberModifies the minimum percentage of the heap kept free after garbage collection. The default value of 40. If at least 40% of the heap is not freed after garbage collection, the heap size increases.
-XX:MaxHeapFreeRatio=percentage as a whole numberChanges the maximum percentage of heap kept free after garbage collection before the heap is shrunk. The default value is 70. This means that if a garbage collection results in more than 70% of the heap being freed, the heap size decreases.
-XX:NewSize=size in bytesSets the default size for the Eden generation of allocated objects. The default value is 640K. (The -server flag increases the default size to 2M.)
-XX:MaxNewSize=size in bytesAllows you to change the upper limit of the young object space in which new objects are allocated. The default value is 640K. (The -server flag increases the default size to 2M.)
-XX:NewRatio=valueChanges the ratio of new to old space sizes from the default value of 8 where the new space is 1/8 the size of the old space.
-XX:SurvivorRatio=numberModifies the ratio of size of the Eden to the survivor space from the default of 10 where Eden is survivorRatio+2 times larger than the survivor space.
-XX:TargetSurvivorRatio=percentageDesired percentage of survivor space used after scavenge. Default is 50.
-XX:MaxPermSize=size in MBModifies the size of the permanent generation. The default is value is 32 (32MB).
-XX:-CleanPagesOnUncommitNormally, when the garbage collection mechanism determines that the heap can be shrunk, i.e., a lot of memory that had been used is no longer needed by the program, the Java VM marks the memory as clean. The operating system is then able to reclaim pages for use by other processes without needing to page out the old memory content to disk. This flag turns off this behavior so that these pages are not marked as clean.
-XincgcThis flag is not supported in Mac OS X. The train garbage collector is not supported.
-Xnoclassgc Disables garbage collection of classes.
-XX:+UseConcMarkSweepGCEnables concurrent mark and sweep garbage collection. This option has an effect only on multiprocessor computers.
-XX:+UseParallelGC Enables parallel garbage collection. This option has an effect only on multiprocessor computers.
-XX:-DisableExplicitGC Ignores explicit calls to System.gc() in your code. The VM still performs garbage collection when it normally would. This option just disallows you from explicitly forcing garbage collection in your code.
-XX:+PrintTenuringDistribution Prints tenuring age information for allocated objects in the young generation.
-XX:CompileThreshold=valueChanges the number of method invocations (branches) before compilation begins. The default is 1000.
-XX:-InlineUnreachedCallsBy default, the VM performs method inlining on whatever code it can to facilitate optimization by the compiler. Setting this flag causes less code to be compiled due to inlining. Code that would not normally be reached, like exceptions, is not inlined and therefore interpreted at runtime. Setting this flag may be detrimental to performance.
-XX:+CITimeDisplays how much time is spent in compiled code.
-XX:NewSizeThreadIncrease=size in KBAllows you to specify how much to increment the young object space size per active thread. This option may be useful in regulating an increased allocation rate due to increased threads. The default increment is 16 (16 kilobytes).
-XX:ThreadStackSize=size in KBChanges the thread stack size from the operating system’s default size.
-XX:+UseTLABEnables a thread-local allocation buffer. Using the buffer allows for more scalable allocation for heavily threaded applications, greatly increasing allocation performance. For Java 1.4.2, it is on by default on multiprocessor computers and in Mac OS X Server. For J2SE 5.0, it is on for all configurations.
Note: These flags are supported in Java 1.4.2 for Mac OS X. For Class Data Sharing in J2SE 5.0, use the - Xshare option as described at http://java.sun.com/j2se/1.5.0/docs/guide/vm/class-data-sharing.html
Last updated: 2006-05-23