Skip to content

Memory leaks on page refresh #1034

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

Closed
aiyer07 opened this issue May 31, 2020 · 6 comments
Closed

Memory leaks on page refresh #1034

aiyer07 opened this issue May 31, 2020 · 6 comments

Comments

@aiyer07
Copy link

aiyer07 commented May 31, 2020

🐛 Bug Report

When refreshing a page that is using useSpring or Spring renderprop I'm noticing a memory leak

To Reproduce

  1. Go to https://codesandbox.io/s/cocky-smoke-v6x9y for a simple count up example
  2. Open browser incognito and open memory tab. Using heap timeline and snapshots, notice the memory steadily increases even after forcing garbage collection
  3. Comment out Spring and there is no memory increase

Expected behavior

Expected memory to be garbage collected on refresh

Environment

Although I am running react-spring 9 i have noticed the same issue on the latest react-spring

  • react-spring v9.0.0-beta.34
  • react v16.13.1 (latest)
  • next v9.4.4 (latest)
@aleclarson
Copy link
Contributor

Please try v9.0.0-rc.3 #985 👍

@aleclarson aleclarson added the template: bug This issue might be a bug label May 31, 2020
@aiyer07
Copy link
Author

aiyer07 commented May 31, 2020

Please try v9.0.0-rc.3 #985 👍

I updated the codesandbox to be v9.0.0-rc.3. Same issue. Just for the sake of visualizing, here's a heap allocation timeline while I refresh the app:

Screen Recording 2020-05-31 at 01 25 PM

@aleclarson
Copy link
Contributor

You can reproduce outside of CodeSandbox?

@aiyer07
Copy link
Author

aiyer07 commented May 31, 2020

@aleclarson Yes I can. I am actually doing something very similar (a simple count up animation) in a next.js app.

Simply creating a spring using useSpring causes the leak in my components. Specifically seems to be a problem on page refresh

@aleclarson
Copy link
Contributor

Ah, I looked over the detail that you're using NextJS. See here: #778

@aleclarson aleclarson added duplicate and removed template: bug This issue might be a bug labels May 31, 2020
@aiyer07
Copy link
Author

aiyer07 commented May 31, 2020

@aleclarson Thanks for that link I'm following that thread now. One thing that might be worth noting is that the codesandbox is not actually using ssr/nextjs, although i did discover the issue initially in a next app.

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