groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ""<>
Subject Category and memory leak
Date Fri, 09 Sep 2016 16:12:23 GMT

I noticed a strange behavior with my use of Groovy categories. If I execute the unit test
[1], the jvm heap and permgen space size don't change, but the memory used by the java process
keep growing. After several hours, this process take more than 1g.

I haven't seen any discussion or issues on this subject, and it's maybe not "the good way"
to use category. In my real usecase, I want to execute an external callback (defined in groovy
with a closure), and this callback is executed with a category in order to help with some
complex classes.

This test is executed in Windows 7, with a JRE 1.7.0_80, but this issue is reproduced too
in production on Linux, with openjdk 1.7.0_91.

Thanks !

public class TestCat {

  public static class A {

  public void testCategory() {
    for(;;) {
      GroovyCategorySupport.use(A.class, new Closure<Object>(null) {
        public Object call() {
          return null;

View raw message