Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container instances retained in memory after installing addon #349

Open
nestortmj opened this issue Jun 29, 2021 · 0 comments
Open

Container instances retained in memory after installing addon #349

nestortmj opened this issue Jun 29, 2021 · 0 comments

Comments

@nestortmj
Copy link

nestortmj commented Jun 29, 2021

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:

  1. ember new leak-test (ember-cli: 3.27.0, node: 14.17.0)
  2. cd leak-test; ember install @ember/jquery
  3. create an integration test that just renders a simple string
  4. ember serve
  5. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant