]> source.dussan.org Git - aspectj.git/commitdiff
fix to save the big chunk of memory leaking over incremental compiles.
authoraclement <aclement>
Thu, 23 Feb 2006 17:05:43 +0000 (17:05 +0000)
committeraclement <aclement>
Thu, 23 Feb 2006 17:05:43 +0000 (17:05 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java

index 3b4197752446da0b654177aee549d2a88f937046..85c7c44a4ee254d02121097c2c05a97afeac3f05 100644 (file)
@@ -115,8 +115,14 @@ public class AjCompilerAdapter implements ICompilerAdapter {
                if (compiler.options.complianceLevel == CompilerOptions.JDK1_5) inJava5Mode = true;
                
                IMessageHandler msgHandler = world.getMessageHandler();
-               weaverMessageHandler = new WeaverMessageHandler(msgHandler, compiler);
-               world.setMessageHandler(weaverMessageHandler);
+               // Do we need to reset the message handler or create a new one? (This saves a ton of memory lost on incremental compiles...)
+               if (msgHandler instanceof WeaverMessageHandler) {
+                       ((WeaverMessageHandler)msgHandler).resetCompiler(null);
+                       weaverMessageHandler = (WeaverMessageHandler)msgHandler;
+               } else {
+                       weaverMessageHandler = new WeaverMessageHandler(msgHandler, compiler);
+                       world.setMessageHandler(weaverMessageHandler);
+               }
        }
 
        // the compilation lifecycle methods below are called in order as compilation progresses...