GitHub user jwagenleitner opened a pull request:

    https://github.com/apache/groovy/pull/325

    GROOVY-7646 - Classes generated by Eval() never collected from 
Permgen/Metaspace

    This is also fixed by PR #219 but that requires SoftReferences to be 
collected (because of beaninfocache).   It seems for cases where a Script class 
is parsed, executed for its result and the Script class is not retained we can 
be more aggressive about clearing it from caches so it doesn't require the heap 
to fill before being collected.
    
    A test is included just to demonstrate the changes do allow the classes to 
be GC'd but is not a test that is meant to be included if the PR is accepted.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy GROOVY-7646

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/325.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #325
    
----
commit 7418b3d7ebd324e0d24c63746e884db632a313d9
Author: John Wagenleitner <[email protected]>
Date:   2016-05-01T19:55:44Z

    GROOVY-7646 - Classes generated by Eval() never collected from 
Permgen/Metaspace
    
    In cases where a Script class is generated just to obtain a result and the 
Class is not retained, the Class should be removed from the ClassInfo cache and 
beanInfoCache in order to allow it to be GC'd.  Otherwise in environments where 
scripts are repeated executed memory will continue to be consumed by these 
classes because beanInfoCache retains soft references to the classes.

commit b708bf8585482cc2bd2739e13eda74c9818d77a6
Author: John Wagenleitner <[email protected]>
Date:   2016-05-01T19:57:25Z

    GROOVY-7646 - test
    
    Just to demonstrate this allows GC of the parsed script classes, it should 
not be included if the PR is accepted.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to