GitHub user jwagenleitner opened a pull request:
https://github.com/apache/groovy/pull/219
GROOVY-7683 - Memory leak when using Groovy as JSR-223 scripting language
I am unsure what if any problems making the Class a `WeakReference` might
have but thought I'd put this out there for review.
I also tested against
[GROOVY-7646](https://issues.apache.org/jira/browse/GROOVY-7646) which was
consistently throwing OOME after <2 mins prior to these changes and ran to
completion with changes.
Another thing I noticed in looking at this class is that [uses a
`PhantomReference`](https://github.com/apache/groovy/blob/73f5979a468f1508134eba20ce503630b0fe0cc7/src/main/org/codehaus/groovy/reflection/ClassInfo.java#L405)
and attempts [to use the value from
`get()`](https://github.com/apache/groovy/blob/73f5979a468f1508134eba20ce503630b0fe0cc7/src/main/org/codehaus/groovy/reflection/ClassInfo.java#L435).
However, this will always return `null` so the code path never executes.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jwagenleitner/groovy GROOVY-7683
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/219.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 #219
----
commit 10689a29cbf167c40b05c38aa5c144724045eeb0
Author: John Wagenleitner <[email protected]>
Date: 2015-12-17T00:44:29Z
GROOVY-7683 - Memory leak when using Groovy as JSR-223 scripting language
----
---
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.
---