OutOfMemoryError trying to run Cactus unit tests

140 Views Asked by At

We have a Hudson/Ant build setup. I have just added a series of Apache Cactus (version 1.8.1) unit tests to the project and am trying to run them after the project builds. I get the following error when it tries to execute the cactus task: "java.lang.OutOfMemoryError: Java heap space."

We have already bumped up the Java heap space as much as we can. Is there a way to make the Cactus task use less memory? Or something else I can do within the test cases themselves to reduce the memory footprint?

2

There are 2 best solutions below

0
Thorbjørn Ravn Andersen On

Are you absolutely certain the tests do not reveal a memory leak?

0
Amir Afghani On

When you say you already bumped up the heap 'as much as you can', can you be more specific? 1g? 2g? Also, why don't you run the Java process with:

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="my_dump.out"

and view the heap dump in a tool like HPjmeter to see what is being held onto in memory? Otherwise, your sort of operating in the dark. Can you also menion whether you're running with a 32-bit or 64-bit JVM?