-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[data grid] Potential Memory Leak in the DataGrid component #15459
Comments
@romgrk could you have a look at this one, please? 🙏🏼 |
Any news on this? We are worried about this too. |
I don't think the issue with detached nodes is a Data Grid issue, it seems to be a React issue – see facebook/react#18116 and facebook/react#26069. Screen.Recording.2024-11-25.at.19.44.00.movDo you experience specific performance issues? |
That seems to be the case, mostly at least. And explains why it's often the whole route's content that's being retained. Interestingly, I also tried to forcefully remove the rootElement's subtree and rootElement itself on unmount, which reduced the memory allocation for the reproduction at least. But for some odd reason, Datagrid's main container still was retained, which could signal that there's a potential issue somewhere within Datagrid still 🤔. On thing I noticed quickly is that the following timer is not cleared on unmount (but probably not the root cause of this issue): mui-x/packages/x-data-grid/src/hooks/features/dimensions/useGridDimensions.ts Lines 124 to 127 in 564be33
Reproduction: https://codesandbox.io/p/devbox/vite-react-forked-7frhqz?workspaceId=8a8eeabe-fead-479a-a993-25a9868e8015 |
To test, wait a few seconds before creating the profile, to avoid triggering it too early and retaining a reference before the garbage collector kicks in. It doesn't get stuck on every navigation, but only on some it seems. It doesn't seem to ever retain the grid footer, only the main container, and Mui-Box's node count is correctly reduced. Both of which also indicate that it's likely not connected to the React's issue. |
But it could also be Emotion's memory leak in dev, which may not exist in prod. Hence, I'd suggest not to go down the rabbit hole to debug it, unless someone can demonstrably show a memory leak in production. |
The issue has been inactive for 7 days and has been automatically closed. |
Steps to reproduce
Steps:
Current behavior
In the Memory tab in the Chrome dev tools, taking snapshots (Both heap shots or detached nodes) after navigating to and back from both pages, detached nodes start accumulating.
Expected behavior
Nodes should not become detached when navigating to and away from the page and should eventually be cleared from memory.
Context
I am trying to use the component to display data, however, the detached nodes start to accumulate without being collected by the garbage collector.
Your environment
npx @mui/envinfo
Search keywords: memory leak Datagrid
The text was updated successfully, but these errors were encountered: