From cfa38afb145d74cd476653d1e98c190e10741d05 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 23 Feb 2006 17:05:43 +0000 Subject: [PATCH] fix to save the big chunk of memory leaking over incremental compiles. --- .../ajdt/internal/compiler/AjCompilerAdapter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java index 3b4197752..85c7c44a4 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java @@ -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... -- 2.39.5