Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Memory leak in tests due to $injector being attached to $rootElement #14094

Closed
gkalpak opened this issue Feb 20, 2016 · 0 comments
Closed

Memory leak in tests due to $injector being attached to $rootElement #14094

gkalpak opened this issue Feb 20, 2016 · 0 comments

Comments

@gkalpak
Copy link
Member

gkalpak commented Feb 20, 2016

#14034 introduced the following memory leak in tests using angular-mocks:

The $injector is attached to the $rootElement (like this) and is never cleaned up.
Since a new $rootElement is created for every test, the leak causes Karma to crash on large test-suites.

@gkalpak gkalpak added this to the 1.5.1 milestone Feb 20, 2016
@gkalpak gkalpak self-assigned this Feb 20, 2016
gkalpak added a commit to gkalpak/angular.js that referenced this issue Feb 20, 2016
Starting with 88bb551, `ngMock` will attach the `$injector` to the `$rootElement`, but will never
clean it up, resulting in a memory leak. Since a new `$rootElement` is created for every test,
this leak causes Karma to crash on large test-suites.
The problem was not detected by our internal tests, because we do our own clean-up in
`testabilityPatch.js`.

This commit prevents the memory leak, by cleaning up all data attached to `$rootElement` after each
test.

Fixes angular#14094
gkalpak added a commit to gkalpak/angular.js that referenced this issue Feb 20, 2016
Starting with 88bb551, `ngMock` will attach the `$injector` to the `$rootElement`, but will never
clean it up, resulting in a memory leak. Since a new `$rootElement` is created for every test,
this leak causes Karma to crash on large test-suites.
The problem was not detected by our internal tests, because we do our own clean-up in
`testabilityPatch.js`.

This commit prevents the memory leak, by cleaning up all data attached to `$rootElement` after each
test.

Fixes angular#14094
gkalpak added a commit to gkalpak/angular.js that referenced this issue Feb 20, 2016
Starting with 88bb551, `ngMock` will attach the `$injector` to the `$rootElement`, but will never
clean it up, resulting in a memory leak. Since a new `$rootElement` is created for every test,
this leak causes Karma to crash on large test-suites.
The problem was not detected by our internal tests, because we do our own clean-up in
`testabilityPatch.js`.

This commit prevents the memory leak, by cleaning up all data attached to `$rootElement` after each
test.

Fixes angular#14094
gkalpak added a commit to gkalpak/angular.js that referenced this issue Feb 21, 2016
Starting with 88bb551, `ngMock` will attach the `$injector` to the `$rootElement`, but will never
clean it up, resulting in a memory leak. Since a new `$rootElement` is created for every test,
this leak causes Karma to crash on large test-suites.
The problem was not detected by our internal tests, because we do our own clean-up in
`testabilityPatch.js`.

This commit prevents the memory leak, by cleaning up all data attached to `$rootElement` after each
test.

Fixes angular#14094
gkalpak added a commit to gkalpak/angular.js that referenced this issue Feb 21, 2016
Starting with 88bb551, `ngMock` will attach the `$injector` to the `$rootElement`, but will never
clean it up, resulting in a memory leak. Since a new `$rootElement` is created for every test,
this leak causes Karma to crash on large test-suites.
The problem was not detected by our internal tests, because we do our own clean-up in
`testabilityPatch.js`.

This commit prevents the memory leak, by cleaning up all data attached to `$rootElement` after each
test.

Fixes angular#14094
gkalpak added a commit that referenced this issue Feb 22, 2016
Starting with 88bb551, `ngMock` will attach the `$injector` to the `$rootElement`, but will never
clean it up, resulting in a memory leak. Since a new `$rootElement` is created for every test,
this leak causes Karma to crash on large test-suites.
The problem was not detected by our internal tests, because we do our own clean-up in
`testabilityPatch.js`.

88bb551 was revert with 1b8590a.
This commit incorporates the changes from 88bb551 and prevents the memory leak, by cleaning up all
data attached to `$rootElement` after each test.

Fixes #14094

Closes #14098
gkalpak added a commit that referenced this issue Feb 22, 2016
Starting with 88bb551, `ngMock` will attach the `$injector` to the `$rootElement`, but will never
clean it up, resulting in a memory leak. Since a new `$rootElement` is created for every test,
this leak causes Karma to crash on large test-suites.
The problem was not detected by our internal tests, because we do our own clean-up in
`testabilityPatch.js`.

88bb551 was revert with 1b8590a.
This commit incorporates the changes from 88bb551 and prevents the memory leak, by cleaning up all
data attached to `$rootElement` after each test.

Fixes #14094

Closes #14098
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant