[ 
https://issues.apache.org/jira/browse/GROOVY-7083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-7083.
-----------------------------

> PermGen memory leak in ConfigSlurper.parse(Script script, URL location)
> -----------------------------------------------------------------------
>
>                 Key: GROOVY-7083
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7083
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 2.3.6, 2.4.1
>            Reporter: Marcin Erdmann
>            Assignee: Daniel Sun
>            Priority: Critical
>             Fix For: 3.0.0-alpha-2, 2.5.0-rc-1, 2.6.0-alpha-4
>
>         Attachments: GROOVY-7083.png
>
>
> The following will quite quickly result in a java.lang.OutOfMemoryError: 
> PermGen space:
> {code}
> while(true) {
>     new ConfigSlurper().parse("")
> }
> {code}
> This is due to ConfigSlurper.parse(Script script, URL location) modifying 
> meta class of the compiled config script class and not clearing it afterwards 
> which means that there is reference to that class in meta class registry and 
> it never gets garbage collected.
> The exception does not occur for the following:
> {code}
> while (true) {
>     new ConfigSlurper() {
>         ConfigObject parse(Script script, URL location) {
>             def config = super.parse(script, location)
>             GroovySystem.metaClassRegistry.removeMetaClass(script.class)
>             config
>         }
>     }.parse("")
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to