When loading all unit tests in a package, the make task raises the error java.lang.OutOfMemoryError: Java in heap space.
If I run all the tests in each subpackage, all the tests load and end just fine. Only when I try to run all the tests in the parent package does an OOM error occur.
I do not think that this problem should be solved by tuning the VM parameters. I tried to increase the maximum heap size and perm, and this did not solve the problem.
This makes me think that there is some problem of garbage collection between loading tests in different packages or that classes loading too intensively.
Is there a JUnit parameter that could solve these problems, or should the problem be solved by modifying or adding code to test cases?
java unit-testing junit out-of-memory
Simon tower
source share