18 Jun 15:05
[groovy-dev] OOM because ScriptEnginge Memory caches all ever compiled Groovy Classes
From: Stefan Majer <stefan.majer@...>
Subject: [groovy-dev] OOM because ScriptEnginge Memory caches all ever compiled Groovy Classes
Newsgroups: gmane.comp.lang.groovy.devel
Date: 2008-06-18 13:07:25 GMT
Subject: [groovy-dev] OOM because ScriptEnginge Memory caches all ever compiled Groovy Classes
Newsgroups: gmane.comp.lang.groovy.devel
Date: 2008-06-18 13:07:25 GMT
Hello,
im using Groovy in a Java Applikation through ScriptEngineManager.
Im calling Groovy scripts every few seconds and im experiencing a
Memory Leak in my applikation.
To demostrate you can use this examples:
With Memory Leak:
public class GroovyLauncherWithLeak {
public static void main(String[] args) throws InterruptedException,
ScriptException {
ScriptEngineManager manager = new ScriptEngineManager();
engine = manager.getEngineByName("groovy");
int counter;
while (true) {
StringBuilder sb = new StringBuilder();
sb.append("return \"hello
").append(counter).append(" \"");
long start = System.currentTimeMillis();
engine.eval(sb.toString()9;
System.out.println("Duration: " +
(System.currentTimeMillis() -
start) + "ms" );
Thread.sleep(50L);
counter += 1;
}
}
}
(Continue reading)
RSS Feed