mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Trying to solve the permgen out of memory problem
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user