#45 Memory leaks in EasyMock

EasyMock (40)


PowerMock builds on top of EasyMock and when running large test suites PowerMock eventually runs out of memory. With standard EasyMock it's not that much of a problem but since PowerMock is using multiple classloaders it becomes a big problem in the long run. We've managed to locate two places where we think EasyMock leaks memory. First is the use of CGLib and I think it has to do with the same issue that Hibernate suffered from (see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2867). I've created a patch for this in EasyMock (see attached files) and I've verified that the memory consumption in PowerMock drops by about 50%.

The other problem is that MocksControl's in the LastControl class are never garbage collected which over time aggregates to a lot of MocksControls, especially if you're running with multiple classloaders. I don't yet know with a certainty if this is EasyMock or PowerMock's fault though.



  • Johan Haleby

    Johan Haleby - 2010-12-27

    Patch for CGLib issue


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks