[
https://issues.apache.org/jira/browse/GROOVY-7731?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-7731.
-----------------------------
> OutOfMemoryError starting from groovy-2.4.5 version.
> ----------------------------------------------------
>
> Key: GROOVY-7731
> URL: https://issues.apache.org/jira/browse/GROOVY-7731
> Project: Groovy
> Issue Type: Bug
> Components: GroovyScriptEngine
> Affects Versions: 2.4.5
> Environment: Ubuntu 14.04, Mac osx 10.11.1
> Java openJDK 1.8, Java HotSpot 1.8
> Reporter: Artyom Kravchenko
> Assignee: John Wagenleitner
> Fix For: 2.4.8
>
>
> I have faced with memory leak as soon as I upgraded groovy from 2.4.4 to the
> latest version (2.4.5).
> As I see groovy-2.4.5 version already contains fix for
> https://issues.apache.org/jira/browse/GROOVY-7591
> and uses ClassInfo.class by default. But such fix causes the other memory
> leak. It is easy to reproduce by simple test:
> public class ScriptsMemoryLeak {
> public static void main(String[] args) throws ScriptException {
> while (true) {
> ScriptEngineManager engineManager = new
> ScriptEngineManager();
> ScriptEngine engine =
> engineManager.getEngineByName("groovy");
> engine.eval("println 'test'");
> }
> }
> }
> I have run this test with -Xmx20m and OutOfMemoryError occurs after about
> 400 iterations:
> Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit
> exceeded
> at sun.misc.URLClassPath$JarLoader.checkResource(URLClassPath.java:771)
> at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:843)
> at sun.misc.URLClassPath.getResource(URLClassPath.java:199)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:364)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:81)
> at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
> at Script478.run(Script478.groovy:1)
> at
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:352)
> at
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:153)
> at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
> at
> ish.oncourse.server.scripting.ScriptsMemoryLeak.main(ScriptsMemoryLeak.java:21)
> When I added -Dgroovy.use.classvalue=true (followed advice in
> https://issues.apache.org/jira/browse/GROOVY-7591 to reactivate use of
> ClassValue) the leak goes away and my test can works infinitely.
> Currently I forced to use -Dgroovy.use.classvalue=true option to proper work
> of my code.
> Also I have find other task which was already closed (but probably was not
> fully done):
> https://issues.apache.org/jira/browse/GROOVY-6704
> From comment I can see that users still faces with the same issue.
> Can someone please advise me will be this memory leak fixed in groovy. If
> yes, then when I will be able to get rid "-Dgroovy.use.classvalue=true" from
> my code
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)