Skip to content

fix(platform-browser): prevent memory leak of style nodes if shadow D…#42005

Closed
JoostK wants to merge 1 commit intoangular:masterfrom
JoostK:shadow-dom-memleak
Closed

fix(platform-browser): prevent memory leak of style nodes if shadow D…#42005
JoostK wants to merge 1 commit intoangular:masterfrom
JoostK:shadow-dom-memleak

Conversation

@JoostK
Copy link
Member

@JoostK JoostK commented May 8, 2021

…OM encapsulation is used

Prior to this change, any inserted <style> nodes into shadow dom trees would be retained
in memory, even after the shadow dom tree has been removed. This commit fixes the memory
leak by tracking the inserted <style> nodes per host element, such that removal of the
host element also releases the style nodes.

Fixes #36655

@JoostK JoostK added memory leak Issue related to a memory leak area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release labels May 8, 2021
@ngbot ngbot bot modified the milestone: Backlog May 8, 2021
@google-cla google-cla bot added the cla: yes label May 8, 2021
…OM encapsulation is used

Prior to this change, any inserted `<style>` nodes into shadow dom trees would be retained
in memory, even after the shadow dom tree has been removed. This commit fixes the memory
leak by tracking the inserted `<style>` nodes per host element, such that removal of the
host element also releases the style nodes.

Fixes angular#36655
@JoostK JoostK force-pushed the shadow-dom-memleak branch from 0221135 to 6b8221d Compare May 8, 2021 18:59
@JoostK JoostK added the action: review The PR is still awaiting reviews from at least one requested reviewer label May 8, 2021
@JoostK JoostK marked this pull request as ready for review May 8, 2021 19:21
@pullapprove pullapprove bot requested a review from mhevery May 8, 2021 19:21
@JoostK JoostK requested review from AndrewKushnir and removed request for mhevery May 8, 2021 19:22
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

LTGM, thanks for the fix @JoostK 👍

@crisbeto thanks for looking into that too and starting a discussion, that definitely gives more context while reviewing this change!

@AndrewKushnir AndrewKushnir 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 May 9, 2021
@AndrewKushnir
Copy link
Contributor

AndrewKushnir commented May 9, 2021

I've started a presubmit and will trigger a global run as well to make sure that there are no cases in g3 that may rely on the old behavior. Thank you.


Update: I've started a global presubmit, will share the status once it's completed.

@AndrewKushnir AndrewKushnir removed the action: presubmit The PR is in need of a google3 presubmit label May 10, 2021
@AndrewKushnir
Copy link
Contributor

AndrewKushnir commented May 10, 2021

@JoostK FYI presubmits (including a global one) went well, so it looks like this PR is ready for merge (just needs the "merge" label) :)

@JoostK JoostK added the action: merge The PR is ready for merge by the caretaker label May 10, 2021
@JoostK
Copy link
Member Author

JoostK commented May 10, 2021

Say no more :-)

alxhub pushed a commit that referenced this pull request May 10, 2021
…OM encapsulation is used (#42005)

Prior to this change, any inserted `<style>` nodes into shadow dom trees would be retained
in memory, even after the shadow dom tree has been removed. This commit fixes the memory
leak by tracking the inserted `<style>` nodes per host element, such that removal of the
host element also releases the style nodes.

Fixes #36655

PR Close #42005
alxhub pushed a commit that referenced this pull request May 10, 2021
…OM encapsulation is used (#42005)

Prior to this change, any inserted `<style>` nodes into shadow dom trees would be retained
in memory, even after the shadow dom tree has been removed. This commit fixes the memory
leak by tracking the inserted `<style>` nodes per host element, such that removal of the
host element also releases the style nodes.

Fixes #36655

PR Close #42005
@alxhub alxhub closed this in 96624b7 May 10, 2021
@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 Jun 10, 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 area: core Issues related to the framework runtime cla: yes memory leak Issue related to a memory leak target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOM Nodes memory leak when using Shadow DOM

3 participants