[ https://issues.apache.org/jira/browse/GROOVY-7083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16010064#comment-16010064 ]
Jochen Kemnade commented on GROOVY-7083: ---------------------------------------- I let the script run with 1000 iterations and took a heap dump. It contains about 180k instances of {{MetaMethodIndex$Entry}}. They look like this: {noformat} this - value: org.codehaus.groovy.runtime.metaclass.MetaMethodIndex$Entry #177145 <- [251] - class: org.codehaus.groovy.runtime.metaclass.MetaMethodIndex$Entry[], value: org.codehaus.groovy.runtime.metaclass.MetaMethodIndex$Entry #177145 <- table - class: org.codehaus.groovy.runtime.metaclass.MetaMethodIndex, value: org.codehaus.groovy.runtime.metaclass.MetaMethodIndex$Entry[] #1009 <- metaMethodIndex - class: groovy.lang.ExpandoMetaClass, value: org.codehaus.groovy.runtime.metaclass.MetaMethodIndex #1009 <- strongMetaClass - class: org.codehaus.groovy.reflection.ClassInfo, value: groovy.lang.ExpandoMetaClass #987 <- value - class: org.codehaus.groovy.reflection.GroovyClassValuePreJava7$EntryWithValue, value: org.codehaus.groovy.reflection.ClassInfo #1239 <- [0] - class: java.lang.Object[], value: org.codehaus.groovy.reflection.GroovyClassValuePreJava7$EntryWithValue #1239 <- [65] - class: java.lang.Object[], value: java.lang.Object[] #139278 <- table - class: org.codehaus.groovy.reflection.GroovyClassValuePreJava7$GroovyClassValuePreJava7Segment, value: java.lang.Object[] #111688 <- [14] - class: org.codehaus.groovy.util.AbstractConcurrentMapBase$Segment[], value: org.codehaus.groovy.reflection.GroovyClassValuePreJava7$GroovyClassValuePreJava7Segment #15 <- segments - class: org.codehaus.groovy.reflection.GroovyClassValuePreJava7$GroovyClassValuePreJava7Map, value: org.codehaus.groovy.util.AbstractConcurrentMapBase$Segment[] #1 <- map - class: org.codehaus.groovy.reflection.GroovyClassValuePreJava7, value: org.codehaus.groovy.reflection.GroovyClassValuePreJava7$GroovyClassValuePreJava7Map #1 <- globalClassValue - class: org.codehaus.groovy.reflection.ClassInfo, value: org.codehaus.groovy.reflection.GroovyClassValuePreJava7 #1 {noformat} > 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)