Ant with JUnit task - OutOfMemoryError

时光怂恿深爱的人放手 提交于 2019-12-11 03:47:23

问题


I have an interesting problem. I am using Ant which executes JUnit tests (test suite composed with 50 tests) via build.xml element. The problem is that I receive OutOfMemoryError.

I have enlarged heap space using ANT_OPTS arguments but it did not help. When I execute the same test suite in Eclipse - everything is fine - memory is released thanks to GC.

I think that this problem is related to Ant and its JUnit task.

Maybe logging of the tests are the reason(but on the other hand I have printsummary="false", [maybe outputtoformatters should be set to false as well???]).

My second guess is that TEST***.xml file (generated at the end of the test) is held in memory and flushed at the end of the test. Is there any way to reduce logs which are in that file?

Guys, please give me some clues.


回答1:


You need to set the maxmemory attribute in the junit task. See the Ant documentation.




回答2:


to sum up I want to say that the root of the problems was logging. Logs were sent to the stream and not flushed. After switching the logs off - everything was fine.




回答3:


By default the fork mode is off. Please try with fork mode on and forkmode set to pertest.



来源:https://stackoverflow.com/questions/11908497/ant-with-junit-task-outofmemoryerror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!