[ 
https://issues.apache.org/jira/browse/GROOVY-7083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16010808#comment-16010808
 ] 

John Wagenleitner commented on GROOVY-7083:
-------------------------------------------

I think the original [pull 
request|https://github.com/groovy/groovy-core/pull/564] should be reconsidered 
since {{ExpandoMetaClasses}} are strong metaclasses.

> 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
>
> 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
(v6.3.15#6346)

Reply via email to