Memory Leak
sophypal opened this issue · 5 comments
I've been running into an issue where my acceptance tests would take up to 2GB on my machine running in Firefox. Taking a heap snapshot after all the tests run reveal a significant amount of memory being retrained by service:ember-elsewhere actives
.
In the screenshot above, most of the Arrays
are from service:ember-elsewhere
. I'm not sure where the problem lie. I have many tests that render a modal but doesn't close it after the tests are done. Is it possible that actives
are not being cleaned up when the service is destroyed?
Clearing out the contents of actives
during destroyApp
cleared the memory leak for me.
const emberElsewhere = application.__container__.lookup('service:ember-elsewhere')
Ember.run(function () {
emberElsewhere.set('actives', null)
})
This suggests that something else in your environment is retaining the entire container. If severing the link from the service to actives solves the problem, then your real problem is that the service itself is being retained, and the service is generally only retained because the whole container is retained.
In your screenshot, the yellow-highlighted function method()
is probably the closure that is responsible. Often this is something like a global event handler.
Thanks, I'll keep looking.
Unfortunately, it's not as clear-cut as that. None of objects in the retaining path resembles anything in my code but rather something deep inside ember-test-helpers
and mocha
.