]> source.dussan.org Git - aspectj.git/commitdiff
free up memory anchored in static at the end of a run
authoracolyer <acolyer>
Fri, 10 Feb 2006 17:55:33 +0000 (17:55 +0000)
committeracolyer <acolyer>
Fri, 10 Feb 2006 17:55:33 +0000 (17:55 +0000)
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompilerDumpTestCase.java

index 99843a3b9408140ec936c683becdfc087fa156e3..2f5c98053c3f03dc1ea1e389d8f21eaf27aec972 100644 (file)
@@ -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;
index c7122eb77c6b5edf3ecb6263be223e4dfbea9b37..1a71cba32f4bb514b4c83a19da9c7e8691a6f128 100644 (file)
@@ -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);