I've noticed a similar problem recently.
p On Wed, Sep 28, 2016 at 9:23 PM, Jeff Adamson <[email protected]> wrote: > Using GroovyShell to evaluate expressions appears to leak permgen space in > 2.4.7 when run with oracle java 7 jvm. > > Should I open a bug report or is there an existing one I can link to? > > Using groovy 2.4.7: this script causes perm-gen error in java 1.7. After > approx 24 thousand evaluate calls it slows for a while due to GC overhead, > then expands perm space and usage rises again until failing OOM ~41k calls > and 7 minutes. > Using groovy 2.4.6: failure is same as 2.4.7 after 4.5 minutes > Using groovy 2.4.0: increases perm-gen usage after a couple minutes, it > does reclaim a large chunk and seems to attain a steady state of usage. > completing in 5 minutes. > Using groovy 2.3.9: perm-gen has a steady-state memory usage pattern for > entire run without any slowdowns over 7.5 minutes > Using groovy 1.8.9: same as 2.3.9. > > ================================= > long sleep = 0; > String scriptText = "println this.binding.variables; return true;"; > > for (int trial = 0; trial < 100; trial ++) { > Thread.sleep(sleep); > for (int i = 0; i < 1000; i++) { > > Map<String,Object> bind = new HashMap<String,Object>(); > bind.put("bindingObject", "a binding object "+i); > > Object result = null; > System.out.println("Run "+trial+"."+i); > > GroovyShell shell = new GroovyShell(new Binding(bind)); > result = shell.evaluate(scriptText); > > System.out.println(trial+"."+i+" result:"+result); > System.out.println(); > } > } > ================================ > > $ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386 > $ groovy -version > Groovy Version: 2.4.7 JVM: 1.7.0_111 Vendor: Oracle Corporation OS: Linux > $ groovy groovyOOM.groovy > .... > Run 41.381 > Caught: java.lang.OutOfMemoryError: PermGen space > Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: > PermGen space > at sun.misc.Unsafe.defineClass(Native Method) > at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63) > > *(See attached file: Screenshot from 2016-09-28 13:38:22.png)* > > > > > > Regards, > Jeff Adamson >
