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

fix(upgrade): avoid memory leak when removing downgraded components #39965

Closed
wants to merge 4 commits into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Dec 3, 2020

This is an alternative to #39921.

Previously, due to the way the AngularJS and Angular clean-up processes interfere with each other when removing an AngularJS element that contains a downgraded Angular component, the data associated with the host element of the downgraded component was not removed. This data was kept in an internal AngularJS cache, which prevented the element and component instance from being garbage-collected, leading to memory leaks.

This commit fixes this by ensuring the element data is explicitly removed when cleaning up a downgraded component.

NOTE:
This is essentially the equivalent of #26209 but for downgraded (instead of upgraded) components.

Fixes #39911
Closes #39921

@google-cla google-cla bot added the cla: yes label Dec 3, 2020
@gkalpak gkalpak added area: upgrade Issues related to AngularJS → Angular upgrade APIs memory leak Issue related to a memory leak target: patch This PR is targeted for the next patch release type: bug/fix labels Dec 3, 2020
@ngbot ngbot bot modified the milestone: Backlog Dec 3, 2020
@mary-poppins
Copy link

You can preview 830b3b0 at https://pr39965-830b3b0.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 61baba2 at https://pr39965-61baba2.ngbuilds.io/.

@gkalpak gkalpak marked this pull request as ready for review December 4, 2020 00:14
@gkalpak gkalpak added the action: review The PR is still awaiting reviews from at least one requested reviewer label Dec 4, 2020
This commit removes some unused parameters, properties and variables in
various `@angular/upgrade` functions.
Previously, due to the way the AngularJS and Angular clean-up processes
interfere with each other when removing an AngularJS element that
contains a downgraded Angular component, the data associated with the
host element of the downgraded component was not removed. This data was
kept in an internal AngularJS cache, which prevented the element and
component instance from being garbage-collected, leading to memory
leaks.

This commit fixes this by ensuring the element data is explicitly
removed when cleaning up a downgraded component.

NOTE:
This is essentially the equivalent of angular#26209 but for downgraded (instead
of upgraded) components.

Fixes angular#39911
Closes angular#39921
@mary-poppins
Copy link

You can preview 7d18ca3 at https://pr39965-7d18ca3.ngbuilds.io/.

Copy link
Member

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GREAT STUFF!

@petebacondarwin petebacondarwin added action: presubmit The PR is in need of a google3 presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 8, 2020
@gkalpak gkalpak added action: merge The PR is ready for merge by the caretaker risk: medium labels Dec 8, 2020
@mhevery
Copy link
Contributor

mhevery commented Dec 8, 2020

presubmit

@mhevery
Copy link
Contributor

mhevery commented Dec 8, 2020

presubmit

mhevery pushed a commit that referenced this pull request Dec 8, 2020
)

This commit removes some unused parameters, properties and variables in
various `@angular/upgrade` functions.

PR Close #39965
mhevery pushed a commit that referenced this pull request Dec 8, 2020
…39965)

Previously, due to the way the AngularJS and Angular clean-up processes
interfere with each other when removing an AngularJS element that
contains a downgraded Angular component, the data associated with the
host element of the downgraded component was not removed. This data was
kept in an internal AngularJS cache, which prevented the element and
component instance from being garbage-collected, leading to memory
leaks.

This commit fixes this by ensuring the element data is explicitly
removed when cleaning up a downgraded component.

NOTE:
This is essentially the equivalent of #26209 but for downgraded (instead
of upgraded) components.

Fixes #39911
Closes #39921

PR Close #39965
@mhevery mhevery closed this in 988b1e3 Dec 8, 2020
mhevery pushed a commit that referenced this pull request Dec 8, 2020
…39965)

Previously, due to the way the AngularJS and Angular clean-up processes
interfere with each other when removing an AngularJS element that
contains a downgraded Angular component, the data associated with the
host element of the downgraded component was not removed. This data was
kept in an internal AngularJS cache, which prevented the element and
component instance from being garbage-collected, leading to memory
leaks.

This commit fixes this by ensuring the element data is explicitly
removed when cleaning up a downgraded component.

NOTE:
This is essentially the equivalent of #26209 but for downgraded (instead
of upgraded) components.

Fixes #39911
Closes #39921

PR Close #39965
@gkalpak gkalpak deleted the fix-upgrade-memory-leak branch December 8, 2020 20:21
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker action: presubmit The PR is in need of a google3 presubmit area: upgrade Issues related to AngularJS → Angular upgrade APIs cla: yes memory leak Issue related to a memory leak risk: medium target: patch This PR is targeted for the next patch release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Downgraded Components are not garbage collected
4 participants