Menu

#45 Memory leaks in EasyMock

EasyMock_3.0
open
nobody
EasyMock (40)
9
2012-10-05
2010-12-27
No

Hi,

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

Discussion

  • Johan Haleby

    Johan Haleby - 2010-12-27

    Patch for CGLib issue

     

Log in to post a comment.