M201370367 / beanshell2

Automatically exported from code.google.com/p/beanshell2
0 stars 1 forks source link

memory leak in bsh.Interpreter due static field #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Interpreter.java has a static field which will hold a back reference to the 
first created Interpreter instance and all local variables of this interpreter.

Simple test case to reproduce:

    public void check_for_memory_leak() throws Exception {
        final WeakReference<Object> reference = new WeakReference<Object>(new Interpreter().eval("x = new byte[1024 * 2024]; return x;"));
        while (reference.get() != null) {
            System.gc();
            Thread.sleep(100);
        }
    }

Original issue reported on code.google.com by pejob...@gmail.com on 16 Sep 2011 at 12:53

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r83.

Original comment by pejob...@gmail.com on 16 Sep 2011 at 1:08

GoogleCodeExporter commented 9 years ago
regression introduced, see issue #51

Original comment by pejob...@gmail.com on 19 Sep 2011 at 3:47

GoogleCodeExporter commented 9 years ago

Original comment by pejob...@gmail.com on 20 Oct 2011 at 7:12