Container instances retained in memory after installing addon
nestortmj opened this issue · 0 comments
nestortmj commented
I have been investigating a memory leak in one of our apps and I’ve noticed that as soon as I add @ember/jquery
to a new ember project, I start to see tons of Container
instances retained in memory after running tests.
Steps to reproduce:
ember new leak-test
(ember-cli: 3.27.0, node: 14.17.0)cd leak-test; ember install @ember/jquery
- create an integration test that just renders a simple string
ember serve
- open up http://localhost:4200/tests, let tests finish running and check the heap snapshot using Chrome’s DevTools
Here’s the test snippet I used for step 3:
// tests/integration/leak-test.js
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Leak', function (hooks) {
setupRenderingTest(hooks);
for (let i = 0; i < 10; i++) {
test(`test ${i}`, async function (assert) {
await render(hbs`Hi`);
assert.ok(true);
});
}
});
With @ember/jquery
installed, I’m seeing one retained Container
instance per test that has been executed (i.e. 10 instances using the snippet above). If I simply remove @ember/jquery
, only one Container
instance is retained.