-
Notifications
You must be signed in to change notification settings - Fork 6.8k
bug(mat-table): memory leak in mat-table #30453
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
Labels
Comments
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Feb 9, 2025
The table has some logic that queues up measurements of rows that will become sticky so that they can be measured once we set up the resize observer. Afterwards the queue is cleared once the measurements are done. angular#29814 introduced a memory leak where the tracking was happening even if the row isn't actually sticky which meant that the resize observer was never set up and the queue kept growing as new rows are rendered. These changes resolve the leak by only queuing the measurement if it's necessary. I've also fixed another potential leak where we were setting up the resize observer, but we weren't destroying it. Fixes angular#30453.
crisbeto
added a commit
that referenced
this issue
Feb 10, 2025
The table has some logic that queues up measurements of rows that will become sticky so that they can be measured once we set up the resize observer. Afterwards the queue is cleared once the measurements are done. #29814 introduced a memory leak where the tracking was happening even if the row isn't actually sticky which meant that the resize observer was never set up and the queue kept growing as new rows are rendered. These changes resolve the leak by only queuing the measurement if it's necessary. I've also fixed another potential leak where we were setting up the resize observer, but we weren't destroying it. Fixes #30453.
crisbeto
added a commit
that referenced
this issue
Feb 10, 2025
The table has some logic that queues up measurements of rows that will become sticky so that they can be measured once we set up the resize observer. Afterwards the queue is cleared once the measurements are done. #29814 introduced a memory leak where the tracking was happening even if the row isn't actually sticky which meant that the resize observer was never set up and the queue kept growing as new rows are rendered. These changes resolve the leak by only queuing the measurement if it's necessary. I've also fixed another potential leak where we were setting up the resize observer, but we weren't destroying it. Fixes #30453. (cherry picked from commit bf94082)
1 task
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Is this a regression?
The previous version in which this bug was not present was
17.3.6
Description
Whenever elements in a mat-table stop becoming visible (for example due to page change with a paginator) the DOM elements stay in memory as detached elements. This only resolves with a page reload.
When checking the retainer on detached table elements it is the StickyStyler.
The behaviour is present since at least version 18.2.8 possibly earlier.
In version 17.3.6 it seems to be working correctly.
Reproduction
StackBlitz link: Stack Blitz from https://material.angular.io/components/table/overview#pagination example
Steps to reproduce:
Expected Behavior
DOM elements of the table that are no longer shown should not be retained as detached elements but properly cleaned up.
Actual Behavior
All DOM elements of the table that are no longer visible stay in memory as detached elements until the page is reloaded.
Environment
The text was updated successfully, but these errors were encountered: