How to set JVM parameters?

I have a build here that performs a rather memory consuming unit test.
Running it in IDEA, I have to pass -Xmx256M to the VM in order for the test to pass, otherwise a "java.lang.OutOfMemoryError: Java heap space" occurs.

In #4037, neither in the Ipr runner, nor in the Maven2 runner the test passes, even though I added "-Xmx512M" to the JVM command line parameters in the runner's setting.
I always get the OutOfMemoryError and had o comment out this test so my build would work.
It seems like the entered JVM command line parameters don't have any effect.

How can I specify the amount of maximum heap space for the used test runners?

Comment actions Permalink


That sounds really strange. Xmx options passed to JVM command line parameters should work in your case. Please take a look at the content of buildAgent/logs/teamcity-agent.log file and look for your option in it.

For IPR runner please note that there is "JVM command line parameters for JUnit" option which allows to specify JVM options for JUnit task (when it is run with fork=true)


Comment actions Permalink

Thank you, the "JVM command line parameters for JUnit" is the option that helped.
For the Maven2 runner, I had to add the following in my pom.xml, as there isn't such an option provided for the Maven2 runner configuration:

org.apache.maven.plugins maven-surefire-plugin -Xmx256M ]]>

Message was edited by:
Tobias Kurzke


Please sign in to leave a comment.