JUnit test runs out of memory -- how to increase heap size?

Luixv picture Luixv · Sep 15, 2011 · Viewed 10k times · Source

I am running a Junit test which throws an exception OutOfMemory. The test is started inside NetBeans 6.9.X. When profiling it I've realized that the Heap maxSize is 64M. I would like to increment this but I couldn't find how to do this.

I already tried right click at the project ->properties ->Run and under the VM options I've set -Xms300M but this didn't work.

Any hint?

Thanks in advance.

Answer

Roshan picture Roshan · Sep 15, 2011

From http://wiki.gephi.org/index.php/NetBeans_Tips#How_to_increase_Heap_Size_for_JUnit_test

Edit your project.properties file and add the line:

test.run.args=-Xms128m -Xmx1400m