| Parameter Name | meaning | Defaults/Notes |
| -Xms | Initial heap size | 1/64 (<1GB) of physical memory By default (MinHeapFreeRatio parameter can be adjusted) When the free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of -Xmx |
| -Xmx | Maximum heap size | 1/4 of the physical memory (<1GB) default (MaxHeapFreeRatio parameter can be adjusted) When the free heap memory is greater than 70%, the JVM will reduce the heap until the minimum limit of -xms |
| -Xmn | Generation size (JDK 1.4 or above) | After increasing the new generation, the size of the old generation will be reduced. This value has a significant impact on system performance. Sun officially recommends the configuration to 3/8 of the entire stack |
| -Xss | The stack size of each thread | After JDK5.0, each thread stack size was 1M, and previously each thread stack size was 256K, which can be in K, M, or G units |
| -XX:ThreadStackSize | Ibid | 0 means the default value is used, and it cannot be united |
| -XX:PermSize | Set the permanent algebra initial value | 1/64 of the physical memory |
| -XX:MaxPermSize | Set the permanent generation maximum | 1/4 of the physical memory |
| -XX:NewRatio | Ratio of Cenozoic (including Eden and two Survivor zones) to Old Age (excluding permanent generation) | -XX:NewRatio=4 means that the ratio of the Cenozoic to the Old Age is 1:4, and the Cenozoic accounts for 1/5 of the entire stack, Xms=Xmx and Xmn is set, this parameter does not need to be set. |
| -XX:SurvivorRatio | The size ratio of the Eden area to the Survivor area | If set to 8, the ratio of two Survivor regions to one Eden region is 2:8, and one Survivor region accounts for 1/10 of the entire Cenozoic |
| -XX:LargePageSizeInBytes | The size of the memory page should not be set too large, as it will affect the size of the Perm | =128m |
| -XX:+UseFastAccessorMethods | Quick optimization of the original type | / |
| -XX:+DisableExplicitGC | Close System.gc() | This parameter requires rigorous testing |
| -XX:MaxTenuringThreshold | Maximum age of garbage | If set to 0, the new generation object will enter the old era directly without passing through the Survivor area. For older applications, efficiency can be improved. If this value is set to a large value, the new generation object will be copied multiple times in the Survivor region, which can increase the survival time of the object in the new generation and increase the probability of being recycled in the new generation, which is only valid for serial GC |
| -XX:+AggressiveOpts | Speed up compilation | / |
| -XX:+UseBiasedLocking | Performance improvements for locking mechanisms | / |
| -Xnoclassgc | Disable garbage recycling | / |
| -XX:SoftRefLRUPolicyMSPerMB | The survival time of SoftReference per megapile of free space | 1s |
| -XX:PretenureSizeThreshold | The size of the object is directly distributed in old age | Another case where the new generation uses Parallel Scavenge GC is invalid, and another case where it is directly assigned in the old age is a large array object with no external reference objects in the array. |
| -XX:TLABWasteTargetPercent | Percentage of TLAB in the Eden area | 1% |
| -XX:+CollectGen0First | Whether YGC comes first when FullGC | false |
| -XX:+UseParallelGC | Full GC uses parallel MSC | See [GC Parameters][1] |
| -XX:+UseParNewGC | Setting the new generation to collect in parallel | It can be used in conjunction with CMS collection, JDK 5.0 or later, and the JVM will set it according to the system configuration, so there is no need to set this value again |
| -XX:ParallelGCThreads | The number of threads for the parallel collector | This value is best configured equal to the number of processors, and is also suitable for CMS |
| -XX:+UseParallelOldGC | The old garbage collection method is Parallel Compacting | This is the parameter option that appears in JAVA 6 |
| -XX:MaxGCPauseMillis | Maximum time per new generation waste collection (maximum pause time) | If this time cannot be met, the JVM will automatically resize the new generation to meet this value. |
| -XX:+UseAdaptiveSizePolicy | Automatically select the size of the new generation area and the corresponding ratio of the survivor area | When this option is set, the parallel collector automatically selects the size of the new generation area and the corresponding proportion of the survivor area to achieve the minimum corresponding time or collection frequency specified by the target system |
| -XX:GCTimeRatio | Set the garbage collection time as a percentage of the program's running time | The formula is 1/(1+n) |
| -XX:+ScavengeBeforeFullGC | Full GC before calling YGC | true |
| -XX:+UseConcMarkSweepGC | Use CMS memory collection | After configuring this in the test, the configuration of -XX:NewRatio=4 is invalid, and the reason is unknown, so it is best to use -Xmn to set the size of the new generation at this time |
| -XX:+AggressiveHeap | The attempt is to use a lot of physical memory | Optimization of long-term large memory usage, can check computing resources (memory, number of processors, at least 256MB of memory) is required |
| -XX:CMSFullGCsBeforeCompaction | How many times do memory compression occur? | Since the concurrent collector does not compress and organize the memory space, it will produce "fragmentation" after running for a period of time, which reduces the operation efficiency |
| -XX:+CMSParallelRemarkEnabled | Lower marker pauses | / |
| -XX+UseCMSCompactAtFullCollection | Compression of the old age when it was FullGC | CMS does not move memory, so it is very easy to produce fragmentation, resulting in insufficient memory, so memory compression will be enabled at this time. It is a good habit to increase this parameter. It may affect performance, but it can eliminate debris |
| -XX:+UseCMSInitiatingOccupancyOnly | Start CMS collection with manual definition initialization | HostSpot is prohibited from triggering CMS GC on its own |
| -XX:CMSInitiatingOccupancyFraction=70 | CMS collection begins after 70% of the garbage is used as garbage recycling | This value needs to be set to meet the following formula, CMSInitiatingOccupancyFraction |
| -XX:CMSInitiatingPermOccupancyFraction | Set the Perm Gen usage to trigger when the ratio is reached | 92 |
| -XX:+CMSIncrementalMode | Set to Incremental mode | Used in single-CPU cases |
| -XX:+CMSClassUnloadingEnabled | Permanent CMS GC | / |
| -XX:+PrintGC | GC log output | Same as -verbose:gc |
| -XX:+PrintGCDetails | Ibid | More details |
| -XX:+PrintGCTimeStamps | Output GC timestamp | Use it with the above PrintGC parameter, or write something like -XX:+PrintGC:PrintGCTimeStamps |
| -XX:+PrintGC:PrintGCTimeStamps | / | Can be mixed with -XX:+PrintGC -XX:+PrintGCDetails |
| -XX:+PrintGCApplicationStoppedTime | The time the program pauses during print garbage collection. Can be mixed with the above | Output format: Total time for which application threads were stopped: 0.0468229 seconds |
| -XX:+PrintGCApplicationConcurrentTime | Print the uninterrupted execution time of the program before each garbage collection | Can be mixed with the above, output form: Application time: 0.5291524 seconds |
| -XX:+PrintHeapAtGC | Print detailed stack information before and after GC | / |
| -Xloggc:filename | Log the relevant log information to a file for analysis | Works with the above few |
| -XX:+PrintClassHistogram | After pressing Ctrl+Break in the console, print the class information | / |
| -XX:+PrintClassHistogramBeforeFullGC | FullGC before printing | / |
| -XX:+PrintTLAB | View the usage of the TLAB space | / |
| XX:+PrintTenuringDistribution | View the threshold for the new survival period after each minor GC | / |
| -ea | Turn on assert assert | / |
| -Xprof | Performance diagnostics | / |
| -Xrunhprof | Performance diagnostics | / |
| -XX:+TraceClassLoading | Prints information about the class loading process | Similar to [Loaded java.util.AbstractList$Itr from /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/lib/rt.jar] |
| -XX:+TraceClassUnloading | Print class uninstall process information | / |
| Xbootclasspath | Specifies the loading of classes that do not require checks | Skipping the necessary pre-load checks can reduce load time, but it is not safe |
| -XX:+PrintCompilation | Print the method name that Hotspot compiles using JIT | / |
| -XX:+HeapDumpOnOutOfMemoryError | OM when generating a heap dump | The default output is in the root folder where the class files are stored |
| -XX:HeapDumpPath | Set the output OM dump file path | Use with -XX:+HeapDumpOnOutOfMemoryError |
| Parameter Name | description | Default |
| -d32 | Use a 32-bit data model (if available) | / |
| -d64 | Use a 64-bit data model (if available) | / |
| -server | Select the server VM | The default VM is server because you are running on a server-like machine. |
| -cp < directory and zip/jar file class search path > | / | / |
| -classpath < the class search path for directories and zip/jar files > | Use : a list of separated directories, JAR archives, and ZIP archives to search for class files | / |
| -D<名称>=<值> | Set system properties | / |
| -verbose: [class or gc or jni] | Enable detailed output | / |
| -version | Output the product version and exit | / |
| -<值>version: | / | Deprecated |
| -showversion | Output the product version and continue | / |
| -jre-restrict-search or -no-jre-restrict-search | / | Deprecated |
| -? -help | Output this help message | / |
| -X | Output help with non-standard options | / |
| -ea[:< package name, class name>] | assert | / |
| -enableassertions[:< package name, class name>] | Enable assertions at the specified granularity | / |
| -da[:< package name, class name>] | / | / |
| -disableassertions[:< package name, class name>] | Disable assertions with a specified granularity | / |
| -esa or -enablesystemassertions | Enable system assertions | / |
| -dsa or -disablesystemassertions | Disable system assertions | / |
| -agentlib:<libname>[=<选项>] | Load the native agent library <libname> | For example, -agentlib:hprofSee also -agentlib:jdwp=help and -agentlib:hprof=help |
| -agentpath:<pathname>[=<选项>] | Load the local agent library by the full pathname | / |
| -javaagent:<jarpath>[=<选项>] | To load the Java programming language agent, see java.lang.instrument | / |
| -splash:<imagepath> | Display the splash screen with the specified image | / |