Set memory profile for unit tests

已回答

Is there a way to alter the max heap etc.. settings of unit tests? if I add -Xmx to vmoptions the unit test execution appears wrapped in a JUnitStarter process which adds its own heap settings that override my choices? e.g. when I try to set max heap to 2g I get:

/opt/mango/jdk1.7.0_45/bin/java -Xmx2g -ea -Xms800m -Xmx800m -XX:MaxPermSize=1024m ...

 

0

Hello Richard,

Am I got you right that you add add -Xmx to vmoptions in JUnit Run configuration? Is it a Maven project?

0

Yes added to the run configuration for the test, after selecting the method to run/test which created the temporary configuration.

It is a maven project and did think about using surefire, but that also compiles, sources libs and generates sources, runs gulp tasks every time which is adding noise to the profiling I'm trying to do. Trying to diagnose a possible memory leak via some tests so need to isolate the suspect code as much as poss. Think I'll try and use org.junit.runner.JUnitCore from junit 4 via the terminal.

 

0

Richard,

Is it possible to share your pom.xml? Usually these vmoptions are overriden be some Maven configuration.

 

0

Ah yes the pom contains this plugin I hadn't noticed before:

 <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<argLine>-Xms800m -Xmx800m -XX:MaxPermSize=1024m -da</argLine>
</configuration>
</plugin>

So that's leaking into individual test executions from IntelliJ when not using mvn/surefire.

 

0

Richard,

We have related requests on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-139378, https://youtrack.jetbrains.com/issue/IDEA-197848

Feel free to vote for them and leave suggestions in comments

 

0

请先登录再写评论。