groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Sun (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7083) PermGen memory leak in ConfigSlurper.parse(Script script, URL location)
Date Fri, 23 Mar 2018 10:55:00 GMT

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

Daniel Sun commented on GROOVY-7083:
------------------------------------

*Here is the snapshot of heap dump when OOME ocurred:*

!GROOVY-7083.png!

> 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)

Mime
View raw message