Trying to solve the permgen out of memory problem

This commit is contained in:
Manindra Moharana
2013-10-12 11:09:42 +05:30
parent 97f4fa6842
commit 2641a2fa3e
2 changed files with 23 additions and 3 deletions

View 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;
}