EasyMock

Memory leaks in EasyMock

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 3.0
  • Fix Version/s: 3.1
  • Component/s: Core
  • Labels:
    None

Description

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

Issue Links

Activity

Hide
Henri Tremblay added a comment -

Thanks a lot for the patch

Show
Henri Tremblay added a comment - Thanks a lot for the patch

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: