Java garbage collection due to Metadata GC Threshold when metaspace occupancy is less than its maximum capacity

Solution Verified - Updated -

Issue

  • A Metadata GC Threshold triggering a collection despite the GC logging showing plenty of available Metaspace. For example, in the following GC log entry the Metaspace occupancy is 256590K, and the Metaspace capacity is 1230848K:

    [Full GC (Metadata GC Threshold) 308976.826: [CMS: 50324K->50420K(1756416K), 0.2793245 secs] 296498K->50420K(2063104K), [Metaspace: 256590K->256590K(1230848K)], 0.2799017 secs]
    

Environment

  • OpenJDK 1.8 u40+
  • Oracle JDK 1.8 u40+

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content