diff --git a/pdex/Todo, GSoC 2013.txt b/pdex/Todo, GSoC 2013.txt index cdd5026ba..d2e577745 100644 --- a/pdex/Todo, GSoC 2013.txt +++ b/pdex/Todo, GSoC 2013.txt @@ -150,6 +150,10 @@ x boolean warningsEnabled - made it volatile General Stuff ============= +* [Critical] PermGen out of memory bug. Manually triggering GC after making the classloader null ensures permgen memory is reclaimed on editor exit. Max open window still limited by max permgen size. Also, added a classloadcounter in ECS to trigger GC periodically. +https://github.com/processing/processing-experimental/issues/1 +See: http://stackoverflow.com/questions/2095974/how-to-unload-a-already-loaded-class-in-java +I'm making the classLoader null, but what about the classes loaded by ASTGen? Investigate. x Disabling Error Checking disables predictions as well! Fixed. x Added doc listener for text area updates x Consult Ben on where to save preferences - main preferences.txt or custom one. - Main prefs file diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index 0b509c191..62ccf3ae4 100644 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -292,10 +292,14 @@ public class ErrorCheckerService implements Runnable{ checkCode(); checkForMissingImports(); } - checkerClass = null; + astGenerator.disposeAllWindows(); - astGenerator = null; + compilationChecker = null; + checkerClass = null; + classLoader = null; + System.gc(); logE("Thread stopped: " + editor.getSketch().getName()); + System.gc(); } protected void updateSketchCodeListeners() { @@ -558,7 +562,11 @@ public class ErrorCheckerService implements Runnable{ for (int i = 0; i < jarFiles.length; i++) { classpath[ii++] = jarFiles[i].toURI().toURL(); } - + + compilationChecker = null; + checkerClass = null; + classLoader = null; + System.gc(); // log("CP Len -- " + classpath.length); classLoader = new URLClassLoader(classpath); // log("1."); @@ -650,7 +658,15 @@ public class ErrorCheckerService implements Runnable{ // log("Compilecheck, Done."); } + private int loadClassCounter = 0; public URLClassLoader getSketchClassLoader() { + loadClassCounter++; + if(loadClassCounter > 100){ + loadClassCounter = 0; + classLoader = null; + System.gc(); + classLoader = new URLClassLoader(classpath); + } return classLoader; }