From: acolyer Date: Fri, 10 Feb 2006 17:55:33 +0000 (+0000) Subject: free up memory anchored in static at the end of a run X-Git-Tag: POST_MEMORY_CHANGES~98 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1c26c6cc4885648ccb398b16daf3c387740f8952;p=aspectj.git free up memory anchored in static at the end of a run --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java index 99843a3b9..2f5c98053 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java @@ -36,6 +36,7 @@ import org.aspectj.bridge.Version; import org.aspectj.bridge.context.CompilationAndWeavingContext; import org.aspectj.util.FileUtil; import org.aspectj.util.LangUtil; +import org.aspectj.weaver.Dump; /** * Programmatic and command-line interface to AspectJ compiler. @@ -243,10 +244,15 @@ public class Main { try { // byte[] b = new byte[100000000]; for testing OoME only! run(args, holder); - } catch (OutOfMemoryError outOfMemory) { + } + catch (OutOfMemoryError outOfMemory) { IMessage outOfMemoryMessage = new Message(OUT_OF_MEMORY_MSG,null,true); holder.handleMessage(outOfMemoryMessage); systemExit(holder); // we can't reasonably continue from this point. + } + finally { + CompilationAndWeavingContext.reset(); + Dump.reset(); } boolean skipExit = false; diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompilerDumpTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompilerDumpTestCase.java index c7122eb77..1a71cba32 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompilerDumpTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompilerDumpTestCase.java @@ -72,6 +72,7 @@ public class CompilerDumpTestCase extends AjcTestCase { */ public void testDumpWithWarnings () { String[] args = new String[] { "src/HelloWorld.java", "src/Pointcuts.aj", "src/DeclareWarning.aj" }; + Dump.preserveOnNextReset(); CompilationResult result = ajc(baseDir,args); String fileName = Dump.dump("DumpTestCase.testDumpWithWarnings()"); dumpFile = new File(fileName);