My Oracle Support Banner

Questions Specific to System.gc() or Runtime.getRuntime.gc() Calls (Doc ID 2549527.1)

Last updated on FEBRUARY 10, 2025

Applies to:

Java SE JDK and JRE - Version 8 to 8
Information in this document applies to any platform.

Goal

  1. If either System.gc() or Runtime.getRuntime.gc() calls are made, do they "force" a Garbage Collection (GC) or just provide a hint to perform a GC?
  2. Can the effects of full garbage collections be mitigated by using options such as -XX:+ExplicitGCInvokesConcurrent?
  3. What can be searched for in the Garbage First Garbage Collector (G1GC or just G1) logs, to determine when a GC was performed as a result of code calling System.gc() or Runtime.getRuntime.gc()?
  4. If a third party library is suspected of calling System.gc() or Runtime.getRuntime.gc() methods explicitly, what techniques can be used to find out which library is making these calls?
     

Solution

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
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.