Eric Sirianni opened SPR-7687 and commented
We are using the Spring TestContext framework (SpringJUnit4ClassRunner) for JUnit test execution. We are hitting OutOfMemoryErrors when running a large number of tests in batch. The problem is that the ApplicationContext objects are building up in the ContextCache (org.springframework.test.context.ContextCache), consuming a large amount of memory.
We have worked around the problem by annotating @DirtiesContext on each JUnit test class.
However, it seems that this issue could be avoided if ContextCache wrapped its cached ApplicationContexts in WeakReferences. This seems to be a best practice when caching potentially large objects such as these.
Affects: 3.0.3
Issue Links:
Referenced from: commits 0cb22fc, d66d160
2 votes, 4 watchers
Eric Sirianni opened SPR-7687 and commented
We are using the Spring TestContext framework (SpringJUnit4ClassRunner) for JUnit test execution. We are hitting OutOfMemoryErrors when running a large number of tests in batch. The problem is that the ApplicationContext objects are building up in the ContextCache (org.springframework.test.context.ContextCache), consuming a large amount of memory.
We have worked around the problem by annotating
@DirtiesContexton each JUnit test class.However, it seems that this issue could be avoided if ContextCache wrapped its cached ApplicationContexts in WeakReferences. This seems to be a best practice when caching potentially large objects such as these.
Affects: 3.0.3
Issue Links:
Referenced from: commits 0cb22fc, d66d160
2 votes, 4 watchers