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

Backport ripple memory leak fix to LTS #28408

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

crisbeto
Copy link
Member

Backports an existing fix from 17.0.x to 16.2.x.

The MatRippleLoader that is used in the button doesn't track any ripples, but instead patches the ripples onto the DOM nodes which in theory should avoid leaks since the ripple will be collected together with the node. The problem is that each ripple registers itself with the RippleEventManager which needs to be notified on destroy so that it can dereference the DOM nodes and remove the event listeners.

These changes avoid the leaks by:

  1. Destroying the ripple when the trigger is destroyed.
  2. Cleaning up all the ripples when the ripple loader is destroyed.
  3. No longer patching directives onto the DOM nodes.

Fixes #28240.

(cherry picked from commit a962bb7)

The `MatRippleLoader` that is used in the button doesn't track any ripples, but instead patches the ripples onto the DOM nodes which in theory should avoid leaks since the ripple will be collected together with the node. The problem is that each ripple registers itself with the `RippleEventManager` which needs to be notified on destroy so that it can dereference the DOM nodes and remove the event listeners.

These changes avoid the leaks by:
1. Destroying the ripple when the trigger is destroyed.
2. Cleaning up all the ripples when the ripple loader is destroyed.
3. No longer patching directives onto the DOM nodes.

Fixes angular#28240.

(cherry picked from commit a962bb7)
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: lts This PR is targeting a version currently in long-term support labels Jan 11, 2024
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Jan 11, 2024
@crisbeto crisbeto merged commit 398197d into angular:16.2.x Jan 11, 2024
28 checks passed
@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 Feb 11, 2024
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 P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: lts This PR is targeting a version currently in long-term support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants