ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Chan <cchan...@yahoo.com>
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 http://www.oopsconsultancy.com/software/xmltask/)
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">
      <classpath>
          <pathelement location="${dbunit.jar}"/>
          <pathelement location="${slf4j-api.jar}"/>
      </classpath>    
    </available>

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

> 
> Stefan
> 

Thanks!
Charles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message