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
Apparent Slow (25 Bytes per Render) Memory Leak with React / React-Dom? #10576
Comments
Can you try with 16 beta? |
Will try with 16 beta now; it would be nice to not have to back out of using React (really like it). BTW, I didn't copy the last line of code (obviously).
|
Just downloaded react 16.0.0-beta.5 and ran: yarn install copied note: Realized that with CRA, the easy button strategy was to over-write these "real" files. Using same procedures as above (using production build), I got the following results (ran it twice to be sure): Memory at start: 8,345K Memory at start: 7,968K note: I also was particularly careful to verify that I was using the newest version during testing by looking at Chrome > Sources > localhost:8080 > static > node_modules > react > react.js (and react-dom > index.js) and confirmed that I was using right files by looking at source:
Let me know if there is anything more I can do to assist. |
Can you look into which objects are being retained? |
NEVERMIND.... It appears that my testing methodology was broken and it does NOT look like there is a problem with React (rather a problem with Chrome). I just so happened to be testing my actual application and noticed that my Chrome "Tab: Developer Tools" was insanely large (70+ MB). When I closed it, I noticed that Chrome's Task Manager stopped showing the steady growth in the application that I was troubleshooting. I was seeing growth like 1 MB per hour in the application itself when Developer's Tools was open. I went back to the React test that I did here and this time left the Chrome Developer's Tools CLOSED and just watched the Task Manager. Originally, I left Developer's tools open so that I could trigger a GC. Without Developer's tools open, I saw the automatic GC process get triggered every so often and the memory would regularly drop way down to 5MB. Kinda reminds me of my quantum physics day (something about Schrodinger's cat). I am going to close this ticket. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
In a long-running React application, finding a very slow memory leak (looks to be about 25 bytes per render). To eliminate virtually everything, wrote the simplest possible examples (at end of issue).
Test methodology was to
note: Also disabled all Chrome extensions before testing and ran the production build (from create-react-app to eliminate any other possible source of leaks).
Memory at start: 8,088K
Memory at end: 8,345K
Difference: 257K
To eliminate the browser, ran test with a simple loop (also at end of issue):
Memory at start: 6,792K
Memory at end: 6,813K
Difference: 21K
note: I really cannot account for why this (maybe the console.log?)
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/84v837e9/).
See code snippets at bottom; wanted to eliminate all sources of leaks so did not use JSFIDDLE.
What is the expected behavior?
Expect the memory usage to be the same as the simple test loop; really should not be any memory growth that is not cleaned up with garbage collection.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Browser: Chrome Version 59.0.3071.115 (Official Build) (64-bit) - LINUX
react: 15.6.1
react-dom: 15.6.1
create-react-app (react-scripts): 1.0.12
Not sure about previous versions of React.
SAMPLE: REACT APPLICATION
SAMPLE: BASELINE APPLICATION
The text was updated successfully, but these errors were encountered: