JDK-6200079 : Apply -XX:+DisableExplicitGC to new JVM versions by default
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: solaris_9
  • CPU: x86
  • Submitted: 2004-11-24
  • Updated: 2010-04-02
  • Resolved: 2004-11-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
It is legal Java practice to initiate a Full GC by calling System.gc(). In old days when memory was limited and heap sizes of Java apps were rather small this was common practice which did not cause harm because full GC runs only took a short time to execute.
With ever larger Java server applications with many threads and heap sizes in the GB range such calls can easily bring a JVM to a virtual halt. Frequently System.gc() calls are introduced by third party libraries or products and the application developers are not aware of them. In these cases, the problem can cause serious performance degradation and project desperation.
The problem can be easily fixed by the -XX:+DisableExplicitGC JVM switch. As most developers don't know this, it would be very useful to apply this switch by default. On the other hand, this should cause no problems to applications which have been making use of System.gc() calls so far. Strictly speaking these calls serve no obvious purpose.

EVALUATION Many problems for Java software projects would never appear. The platform would be more robust. ###@###.### 2004-11-24 18:14:55 GMT This seems like a really bad idea. We should educate people not to call System.gc(), not break any programs that are currently using it in the few situations where it is necessary. E.g., src/share/classes/java/nio/Bits.java. People who have third-party libraries that call System.gc() too much should lean on their vendors to fix their libraries. This would also break a large amount of our test code, which seems to call System.gc() for its own reasons. ###@###.### 2004-11-24 19:40:38 GMT

WORK AROUND Apply the switch -XX:+DisableExplicitGC to the JVM (most customers ignore the problem and the solution, however) ###@###.### 2004-11-24 18:14:55 GMT

SUGGESTED FIX Apply the switch -XX:+DisableExplicitGC by default. Offer an additional switch -XX:+EnableExplicitGC for the suspected rare cases where this might make sense. ###@###.### 2004-11-24 18:14:55 GMT