ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Chan <>
Subject Re: "OutOfMemoryException: PermGen space" error with Ant?
Date Mon, 25 Jun 2012 20:47:12 GMT
> There are several hints about a memory leak in Ant related to not

> cleaning up classloaders used for loading typedefs/taskdefs in
> subbuilds.  So far we haven't pinned down the problem.

I can definitely see the memory usage for "java.exe" in task manager creeping up. :(

> Are you defining the dbunit tasks inside the <for> or are you spawning
> new <ant> or <subant> ot <antcall> tasks inside <for> 
> that would do so?
> If so you may be able to work around the problem by defining the tasks
> inside the main build before the for loop.

I have tested all of the following combinations and all of them fails after ~50 calls.
1. In main <project>, call <dbunit> sequentially (copy and paste)
2. In a <task>, call <dbunit> sequentially (copy and paste)
3. In a <task>, call <for> loop to execute <dbunit>
4. In a <task>, call <xmltask> (from
to extract integer from each child node, and execute <dbunit>

I can try to rewrite it using <ant>, <subant>, <antcall>, but how can I
pass a @variable to the task I am calling?

> The other things you may be leaking are JDBC drivers.  You could try to
> load the driver inside the main build explicitly so it never ends up on
> any other classloader (<available> should help).

I tried to add the following inside my main <project>, but unfortunately, it failed
as well. Am I doing it correctly?

    <available property="preloadDbUnit" classname="org.dbunit.ant.DbUnitTask">
          <pathelement location="${dbunit.jar}"/>
          <pathelement location="${slf4j-api.jar}"/>

    <available property="preloadMySQLJdbc" classname="com.mysql.jdbc.Driver">
          <pathelement location="mysql.jar"/>

> Stefan


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message