groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Adamson" <>
Subject Re: Serious memory leak in groovy 2.4.7?
Date Thu, 29 Sep 2016 15:13:12 GMT

Thanks, will check those options out.

Jeff Adamson

From:	John Wagenleitner <>
Date:	09/28/2016 05:48 PM
Subject:	Re: Serious memory leak in groovy 2.4.7?

It might be related to GROOVY-7683 [1].  I ran the script
with 2.4.8-SNAPSHOT and it completes successfully.  I can replicate the
problem with 2.4.7.  As a workaround, I can get it to work with 2.4.7 if I
use the following:

groovy -Dgroovy.use.classvalue=true groovyOOM.groovy


On Wed, Sep 28, 2016 at 12:23 PM, Jeff Adamson <>
  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 ++) {
  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);

  $ 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(

  (See attached file: Screenshot from 2016-09-28 13:38:22.png)

  Jeff Adamson

View raw message