You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Loughran <st...@apache.org> on 2007/06/29 12:43:25 UTC

Re: AW: Ant within Eclipse Junit OutOfMemoryException

Knuplesch wrote:
> Hi,
> 
> I use an Ant Script tu run a lot of Junit Tests. I had to change the maxmemory to 1024m to let all the Tests run.
> But sadly I used Ant directly and not Eclipse.
> 
> But this is how I solved my memory problem in the Ant-Task:
> 
> 
> <junit errorproperty="dope.test.failed"
>            failureproperty="dope.test.failed"
>            maxmemory="1024m"
>            fork="yes">
>       <classpath>
>         <path refid="junit.classpath"/>
>       </classpath>
>       <formatter type="brief" usefile="false"/>
>       <formatter type="xml" usefile="true"/>
>         <batchtest todir="${dope.report.dir}">
>             <fileset dir="${cvs.exportbox}/source" >
>                 <include name="de/icongmbh/**/*Test.java"/>
>                 <include name="functional/**/*Test.java"/>
>                 <include name="regression/**/*Test.java"/>
>             </fileset>
>         </batchtest>
>     </junit> 
> 
> 
> 
> 

that should work in eclipse too. Note that if your unit tests run out of 
memory, it means your code is leaking somehow.

Look at http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/TSG-VM.pdf 
for some info on how to handle this. You can set up a forking JUnit to 
to dump the heap on a memory overflow on recent java5 and all java6 JREs:

<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />

this creates a heap dump that jhat can bring up in a web site for you to 
browse round and debugl

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