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 comp: upgrade 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
@gkalpak gkalpak force-pushed the fix-upgrade-memory-leak branch from b667c27 to 830b3b0 Compare Dec 3, 2020
@mary-poppins
Copy link

@mary-poppins mary-poppins commented Dec 3, 2020

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

@gkalpak gkalpak force-pushed the fix-upgrade-memory-leak branch from 830b3b0 to 61baba2 Compare Dec 3, 2020
@mary-poppins
Copy link

@mary-poppins mary-poppins commented Dec 3, 2020

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

@gkalpak gkalpak marked this pull request as ready for review Dec 4, 2020
@gkalpak gkalpak requested a review from petebacondarwin Dec 4, 2020
gkalpak added 4 commits Dec 7, 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
@gkalpak gkalpak force-pushed the fix-upgrade-memory-leak branch from 61baba2 to 7d18ca3 Compare Dec 7, 2020
@gkalpak gkalpak requested a review from petebacondarwin Dec 7, 2020
@mary-poppins
Copy link

@mary-poppins mary-poppins commented Dec 7, 2020

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

Copy link
Member

@petebacondarwin petebacondarwin left a comment

GREAT STUFF!

@petebacondarwin petebacondarwin added action: presubmit A standard presubmit is running / required and removed action: review labels Dec 8, 2020
@gkalpak gkalpak added action: merge PR author is ready for this to merge risk: medium labels Dec 8, 2020
@mhevery
Copy link
Contributor

@mhevery mhevery commented Dec 8, 2020

presubmit

@mhevery
Copy link
Contributor

@mhevery mhevery commented Dec 8, 2020

presubmit

mhevery pushed a commit that referenced this issue 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 issue 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 issue 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 Dec 8, 2020
twerske pushed a commit to twerske/angular that referenced this issue Jan 5, 2021
…ular#39965)

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

PR Close angular#39965
twerske pushed a commit to twerske/angular that referenced this issue Jan 5, 2021
…ngular#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 angular#26209 but for downgraded (instead
of upgraded) components.

Fixes angular#39911
Closes angular#39921

PR Close angular#39965
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Jan 8, 2021

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 PR author is ready for this to merge action: presubmit A standard presubmit is running / required cla: yes comp: upgrade 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.

4 participants