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

Bug: Detached DOM node memory leak #18066

Closed
jdolearydl opened this issue Feb 18, 2020 · 6 comments
Closed

Bug: Detached DOM node memory leak #18066

jdolearydl opened this issue Feb 18, 2020 · 6 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@jdolearydl
Copy link

Given a table in react that displays data from an API which can be refreshed with completely new information, I observed a detached DOM node leak (notice the green numbers):

leakGif

Note: The DOM Nodes seem to settle at 21,000 but there shouldn't be that many nodes anyway, as you can see it starts at 7,000 after the first table generation. In my real-world app, these detached nodes persist even through navigation (with react router).

React version: 16.12.0

Steps To Reproduce

  1. Open the example full page (link to code below)
  2. Open chrone dev tools and view the "Performance Monitor" tab
  3. Click the "Regen" button many times
  4. Notice that the DOM Nodes increase and even after a GC not all the detached nodes are cleaned up

Link to code example:
Codesandbox

The current behavior

The DOM Nodes continue to increase when the table is regenerated, and even after a GC, not enough of the detached nodes are cleaned up.

The expected behavior

I would expect all the detached nodes to be cleaned up after a GC as they are in this example.

@jdolearydl jdolearydl added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Feb 18, 2020
@jddxf
Copy link
Contributor

jddxf commented Feb 19, 2020

I believe it's already fixed in #17666. You can confirm it here.

@jdolearydl
Copy link
Author

Yes, that resolved it. Will this be included in the next release?

@jddxf
Copy link
Contributor

jddxf commented Feb 19, 2020

I don't know for sure but I guess so.

@kelly-tock
Copy link

anyone seeing this in react 17 as well?

@kamilzielinskidev
Copy link

@kelly-tock just found it today, these nodes number comes back after few rerenderes but still very tricky thing

@kelly-tock
Copy link

I eventually found it via heap snapshots, so my case was not react related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

4 participants