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

10,773

Solution 1

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

Solution 2

You can also increase the max size for all VMs by setting this environment variable for your OS:

 _JAVA_OPTIONS=-Xmx300m

Solution 3

Have you adjusted -Xmx as well as -Xms

-Xms300m will force java using no less 300m, and -Xmx300m will let jvm use no more than 300m

Solution 4

You can try this and see if it helps:

-XX:MaxPermSize=128m
Share:
10,773
Luixv
Author by

Luixv

More than 20 years of experience in programming and management.

Updated on June 17, 2022

Comments

  • Luixv
    Luixv almost 2 years

    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.