GC - 垃圾回收器相关参数汇总

A5.1 Heap Layout

Option Default value Max Value Description
-XX:NewSize2Mb< 100 GBControls the initial size of young generation
-XX:MaxNewSize < 100 GBControls the maximum size of the young generation
-XX:SurvivorRatio8 on windows, and 64 on Solaris<100000Controls the size of the eden and the survivor spaces
-Xms5 MB< 100 GBInitial heap size
-Xmx4 MB< 100 GBMaximum heap size
-Xmn  Size of young generation
-XX:MaxTenuringThreshold31 Maximum number of times object is aged. Set this to 0 to enable promoteall.
-XX:PermSize4 MB< 10 GBInitial size of permanent generation
-XX:MaxPermSize64 MB< 10 GBMaximum size of permanent generation
-XX:NewRatio2 for server, 8 for client on Solaris Ratio of young generation / old generation
-XX:PretenureSizeThreshold0 Objects size greater than this is directly allocated in the older generation
-XX:+UseISM  Use intimate shared memory (see section 16.2.6.1)
-XX:+UseMPSS  Use multiple page sizes (see section 16.2.6.1)
-XX:+UseTLABTrue on Solaris Use thread-local object allocation
-XX:+AggressiveHeap  Use for throughput applications with lots of CPUs and memory > 256MB. Turns on various flags, uses parallel scavenge collector for young generation, turns onAdaptive
SizePolicy
, increase sizes of TLAB and other data structures
-XX:TargetSurvivorRatio50100Desired percentage of survivor space used after a scavenge

A5.2 Parallel Copying Collector

Option Default value Max Value Description
-XX:+UseParNewGC  Enables young generation parallel copying collector. Use with concurrent collector or default mark-sweep-compact collector
-XX:ParallelGCThreadsAs many threads as CPUs Controls the number of threads used for copying collection

A5.3 Concurrent Collector

Option Default value Max Value Description
-XX:+UseConcMarkSweepGC  Enables old generation concurrent collection
-XX:UseCMSCompactAtFullCollectionfalse Enable compaction Full GC and if full collection are occurring too frequently
-XX:CMSFullGCsBeforeCompaction1 Parameter that affects compaction of the old generation. If at least this number of concurrent collections has not succeeded between full collection, do a compaction on full collections. If 0, always do compactions on full collections whenUseCMS
Compact
AtFull
Collection
 is true
-XX:PrintCMSStatistics0 If > 0, Print statistics about the concurrent collections. For example, the number of times the concurrent collection yield to a young generation collection and the number of cards precleaned
-XX:PrintFLSStatistics0 If > 0, print statistics about the concurrent free lists. For example, a fragmentation parameter
-XX:PrintFLSCensus0 if > 0, print the populations of the CMS free lists
-XX:CMSInitiatingOccupancyFraction68% Change the percentage when a CMS collection is started

A5.4 Parallel Scavenge Collector

Option Default value Max Value Description
-XX:UseParallelGC  Enables young generation parallel scavenge collector. Works only with the default mark-sweep-compact collector. Do not use with the concurrent collector.
-XX:+UseAdaptiveSizePolicyfalse Automatically sizes the young generation and chooses an optimum survivor ratio to maximize performance.
-XX:+PrintAdaptiveSizePolicyfalse Prints information about adaptive size policy
-XX:ParallelGCThreadsAs many threads as CPUs Controls the number of threads used for copying collection

A5.5 Verbose GC options

Option Default value Max Value Description
-XX:+PrintGCDetailsfalse PrintGC details
-XX:+PrintGCTimeStampsfalse Adds timestamp info to GC details
-XX:+PrintHeapAtGCfalse Prints detailed GC info including heap occupancy before and after GC
-XX:+PrintTenuringDistributionfalse Prints object aging or tenuring information
-XX:+PrintHeapUsageOverTimefalse Print heap usage and capacity with timestamps
-Xloggc:filenamefalse Prints GC info to a log file
-verbose:gcfalse Prints some GC info
-XX:+PrintTLABfalse Print TLAB information

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值