steveszc / ember-cli-memory-leak-detector

Automatic memory leak detection for ember apps
https://www.npmjs.com/package/ember-cli-memory-leak-detector
MIT License
38 stars 5 forks source link

False posititives? #32

Closed lolmaus closed 3 years ago

lolmaus commented 3 years ago

Hi!

I installed the addon to a fresh app, updated the testem config and ran ember t -s.

It reported every userland class as retained! The number of instances for each class seems to correspond to the number of times they've been used in tests, so basically everything was retained.

I've also tried capturing a memory allocation timeline snapshot manually in http://localhost:4200/tests mode and it showed 0% retention for both userland classes such as ApplicationRoute and Ember classes such as RouterService. So basically the report generated by the addon is wrong.

lolmaus commented 3 years ago

image

image

steveszc commented 3 years ago

Not sure what to make of this. I've run this addon against against real apps and addons and not run in to false positives of the kind you're reporting here. However, the test coverage and my manual testing have been pretty limited this far, so it's very possible things may not work quite right in certain project configurations.

Was there anything non-standard about your project? Are you able to share your reproduction repo?

Also, you may try the setting the writeSnapshot option to true and uploading the resulting snapshot file into chrome devtools to double check what is retained.

steveszc commented 3 years ago

Since this issue originally reported I've run the addon on several additional apps and addons and have not run into anything like what was reported here. I'm going to close this for now, but I'm happy to re-open if anyone else runs into this, or if a reproduction repo can be provided.

steveszc commented 3 years ago

Also, unsure if this is related, but within the last month I added the additional step of running GC prior to capturing the heap snapshot. Its possible that not running this manual GC could have produced an incorrect result inline with what was reported here... so hopefully that was the issue and its fixed now 🤞

https://github.com/steveszc/ember-cli-memory-leak-detector/commit/796575ba611a6583f65cf9e1fa5eedbbd49e5811