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

Memory leak with many components and user input #15637

Closed
tariqporter opened this issue May 13, 2019 · 3 comments
Closed

Memory leak with many components and user input #15637

tariqporter opened this issue May 13, 2019 · 3 comments

Comments

@tariqporter
Copy link

tariqporter commented May 13, 2019

Do you want to request a feature or report a bug?

Report a bug

What is the current behavior?

When creating many elements with react, and providing some user action - scrolling in this example, the memory will continually increase and never be garbage collected

https://github.com/tariqporter/react-memory-leak

git clone https://github.com/tariqporter/react-memory-leak
cd react-memory-leak
yarn start

Click the Start button

image

And start scrolling up and down the page (Will keep attempting to automate the scrolling with the bug persisting)

The memory will continually increase and never be garbage collected. Once the bug begins happening, the user no longer needs to scroll; the memory will keep increasing without any input. 2GB of memory used within a couple of minutes:

image

This is part of a larger application that has meant it has become unusable with react 16x. It uses react-virtualized, and we also created our own table virtualization, but this memory leak happens with both of them, hence creating this issue.

What is the expected behavior?

I would expect garbage collection to happen at some point and look like the following (The following is the same example with no user input)

image

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

This is tested in chrome 74.0.3729.131 and firefox 66.0.5 on react 16.8.6. We believe it is for all react 16x

@tlenex
Copy link

tlenex commented May 24, 2019

There is a patch #15157 that could help. Can you try it out @tariqporter ?

@tariqporter
Copy link
Author

#15157 This seems to resolve the issue we have in our application.

The production build still seems to be noticeably slower than development, but that is likely another issue.

@tariqporter
Copy link
Author

Upgrading to v16.9 has resolved this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants