mockery icon indicating copy to clipboard operation
mockery copied to clipboard

fix: remove cached modules completely from require cache in disable()

Open wenboyu2 opened this issue 6 years ago • 1 comments

Problem: We noticed memory leak with require cache when using mockery.enable({useCleanCache: true}). disalbe() doesn't clean up the cache completely.

Solution: Remove module references from m._cache as well as the module's parents' children.

wenboyu2 avatar Jan 03 '19 19:01 wenboyu2

@mfncooper we've verified this PR fixes the memory leak we were seeing. Any chance of getting this merged?

pklingem avatar Aug 15 '19 16:08 pklingem