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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.