groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Adamson" <jwadam...@us.ibm.com>
Subject Serious memory leak in groovy 2.4.7?
Date Wed, 28 Sep 2016 19:23:48 GMT


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

Mime
View raw message