Do Not Set -XX:MaxTenuringThreshold to a Value Greater Than 15
(Doc ID 1283267.1)
Last updated on FEBRUARY 26, 2019
Applies to:Java SE JDK and JRE - Version 1.5.0 and later
Information in this document applies to any platform.
When tuning the Java garbage collector (GC), so called 'survivor spaces' can be configured to "age" new objects. This can reduce fragmentation in the old space of the heap, particularly when using the Concurrent Mark Sweep (CMS) collector.
The Java command line parameter -XX:MaxTenuringThreshold specifies for how many minor GC cycles an object will stay in the survivor spaces until it finally gets tenured into the old space.
Many tuning documents and forum discussions mention a maximum value of 31 for this parameter. However, since version 1.5.0_06, and in all versions of Java 6, the maximum value has been reduced to 15.
If a value greater than 15 is set, this now specifies that objects should never tenure. This is very bad, as the survivor space will be consumed indefinitely by old objects. This in turn leads to instant promotion of all newly created objects, rapidly leading to heap fragmentation.
A fragmented heap cannot accommodate as many objects as a compacted heap. Hence the CMS GC might have to be abandoned in favour of a full 'stop-the-world' GC to defragment the heap. The practical impact is likely to be an increased number of unnecessary application pauses.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document