From ae5f8603d5a155c09d88fbcf43e734a62e93e901 Mon Sep 17 00:00:00 2001 From: Costin Manolache Date: Thu, 21 Nov 2002 22:40:45 +0000 Subject: [PATCH] I hope this won't brake anything :-), but I need to try it. Remove the reference to the task after the task execution. Next time the task is called a new instance will be created. This avoids excessive memory usage and potential leaks in large programs. All the memory that is used by the task - i.e. the task itself and all the object it creates - are beeing hold in memory and prevented from GC by this reference. I hope this will remove some OutOfMemory errors for large build files. Nicola - please let me know if you see any problems after this change ! git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273574 13f79535-47bb-0310-9956-ffa450edef68 --- .../embed/src/java/org/apache/tools/ant/UnknownElement2.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proposal/embed/src/java/org/apache/tools/ant/UnknownElement2.java b/proposal/embed/src/java/org/apache/tools/ant/UnknownElement2.java index fa6efc0d6..454da0aef 100644 --- a/proposal/embed/src/java/org/apache/tools/ant/UnknownElement2.java +++ b/proposal/embed/src/java/org/apache/tools/ant/UnknownElement2.java @@ -198,6 +198,9 @@ public class UnknownElement2 extends UnknownElement { if (realThing instanceof Task) { ((Task) realThing).execute(); } + // the task will not be reused ( a new init() will be called ) + // Let GC do its job + realThing=null; } /**