You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2012/07/02 17:31:24 UTC
Re: "OutOfMemoryException: PermGen space" error with Ant?
On 2012-06-25, Charles Chan wrote:
>> 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?
This would probably just be a wasted effort. If 1. fails then the
problem is not related to subbuilds at all. Anyway, you can
parameterize <antcall> with nested <param> elements and they'd appear as
properties in the subbuild.
>> 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>
The available tasks fail or the build fails? The syntax of available
looks good to me.
It might be a memory leak in Ant itself or inside the dbunit task, I
don't know - in particular I'm not familiar with the dbunit task and how
it works under the covers at all.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org