You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Andrew van der Voort <an...@astarte.co.nz> on 2003/04/23 06:29:54 UTC

Memory usage with ant

We have an ant task to perform our testing. This ant task starts jboss and
invokes junit telling it to run all our test classes. Since the test
classes all end in 'Test' (e.g. ProjectTest) and no other class does, it
just picks up all the struts test classes. 

Note that we do not have an AllTests class which builds up a suite of all
the test classes since what we've done picks them all up anyway. We tried
using the AllTests approach, but it made no difference. 

Note also that we are using StrutsTestCase for JUnit on the front end to
drive struts and that this is in container testing not mock.

The start jboss task looks like this:
  <target name="jboss.start" description="Starts JBoss on local
workstation">
    <java classname="org.jboss.Main"
classpath="${env.JAVA_HOME}/lib/tools.jar;${jboss.home}/bin/run.jar"
fork="true" dir="${jboss.home}/bin"  >
      <jvmarg value="-Dprogram.name=run.bat"/>
      <jvmarg value="-Xms256m"/>
      <jvmarg value="-Xmx384m"/>      
    </java>
  </target>

The ant task looks like this:
    <junit printsummary="false"
           haltonfailure="false"
           fork="true"
           errorProperty="test.failed"
           failureProperty="test.failed">
      <classpath refid="test.classpath.compilation"/>
      <formatter type="brief" usefile="false"/>
      <formatter type="xml"/>
      <batchtest todir="${test.data.dir}">
        <fileset dir="${build.dir}/classes" includes="**/*Test.class"/>
      </batchtest>  
    </junit>
All the tests run, but the memory used is enormous. We are regularly
hitting a situation where the tests halt with an out of memory condition
and end up having to bump the memory available to JBoss. The process
running the tests gets to about 73M at the time JBoss is started, then on
up to about 367M by the time the tests are finished. This makes for a total
machine memory footprint of over 625M which immediately drops to 153M once
the tests are finished. We have 290 tests in 37 classes.

Does anyone know why this might be? This is getting worse and worse, and we
are getting to a point where it is not scalable to continue writing test
cases.

Thanks, Andrew