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

I run a Junit test that throws an OutOfMemory exception. The test runs inside NetBeans 6.9.X. When profiling, I realized that the maximum Heap size is 64M. I would like to increase this but I could not find how to do it.

I already tried right-clicking on the project -> properties -> Run and on the VM parameters I installed -Xms300M, but that did not work.

Any clues?

Thanks in advance.

+5
source share
5 answers

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

Modify the project.properties file and add the line:

test.run.args=-Xms128m -Xmx1400m
+5
source

, :

 _JAVA_OPTIONS=-Xmx300m
+3

-Xmx, -Xms

-Xms300m java 300 , -Xmx300m jvm 300

+2
source

You can try this and see if it helps:

-XX:MaxPermSize=128m
+1
source

While a Java program usually does not skip memory in the usual sense, there may be memory unnecessarily occupied in collections such as lists and maps. Use the profiler to find out where the memory is used, you are likely to find opportunities for optimization.

0
source

All Articles