DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33061>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33061

           Summary: OutOfMemoryError with custom Task in sub-build
           Product: Ant
           Version: 1.6.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Our situation:

We do have a product build from 80+ modules. Each module has its own 
buildscript, which is called from a master buildscript. The module build 
scripts define custom tasks, which make use of thirdparty libraries, for 
example Dom4J. Now, since we introduced those custom tasks, we get 
OutOfMemoryErrors somewhere in the build process, even if we give it incredible 
amounts of memory (1 GB, for example).

We don't get this error when putting dom4j.jar into the Ant classpath, so this 
is a workaround for now. It isn't acceptable for the long term though, as we 
plan to use even more custom tasks which might use other thirdparty libraries 
and have to maintain several Ant installations, so this would represent too big 
a maintenance burden.
----
Reproducing the problem:

The attached zipfile contains four files to reproduce the problem:
- a minimal custom task using Dom4J
- a minimal test.xml that is loaded by the custom task using Dom4J
- a subbuild.xml which defines the task and calls it
- a build.xml which simply calls subbuild.xml a huge amount of times

* compile DummyTask.java
* update the classpath definition in subbuild.xml to your local environment
* run build.xml using Ant 1.6.2, JDK 1.4.2, without having dom4j.jar in the 
classpath, giving it 2MB of heap (-mx2m). After some time, you get an 
OutOfMemoryError
* try the same with dom4j.jar in the Ant classpath. You don't get the error.
----
Analysis:

Adding some debug statements to AntClassLoader and running Ant in JProfiler, it 
becomes obvious that neither the AntClassLoader, nor the Dom4J classes used for 
loading and executing the custom task ever get garbage collected. Those classes 
build up in memory until it comes to the OutOfMemoryError.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to