java.lang.OutOfMemoryError: PermGen when using groovy scripts

Solution Unverified - Updated -

Issue

  • We exhaust our PermGen space and see thousands of Script# classes loaded by groovy.lang.GroovyClassLoader$InnerLoaders. The heap dump shows them retained in GroovyClassLoader's classCache:
Class Name                                                                                                          | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap 
---------------------------------------------------------------------------------------------------------------------------------------------------------
gs groovy.lang.GroovyShell @ 0x707b3bbe0                                              |       30,682 |            56 |         6,381,856 |            88 
 '- loader groovy.lang.GroovyClassLoader @ 0x707b3bf20                    |       30,682 |          192 |         6,381,856 |     1,999,032 
    '- classCache java.util.HashMap @ 0x707b3c388                                  |       30,682 |            72 |         6,381,856 |     1,997,120 
---------------------------------------------------------------------------------------------------------------------------------------------------------

Environment

  • JBoss Enterprise Application Platform (EAP)
  • Groovy

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