Closed H-a-w-k closed 11 months ago
Hey @brainkim, any news about this issue? In our project, we've experienced the same problem.
Experiencing the same exact thing on React Native, very severely
I just did a 7 minute-sampling with the example given (but an update every 10ms, not 500, so I'd expect to see it even more), but I'm not seeing a significant heap size increase. I could understand this happening in React Native (as I already explained to @israelidanny in https://github.com/apollographql/apollo-client/issues/7775#issuecomment-1569695477 - please don't spam!), but I can't make sense of this in modern browsers.
@H-a-w-k, @michal-damiecki, could you give a bit more context on the environments where you were experiencing these issues?
Since there hasn't been any more feedback for half a year and we cannot reproduce it ourselves, I'm closing the issue.
At the same time I want to bring it to your attention that the upcoming version 3.9 (out in beta right now) will contain a lot of memory fixes: See the announcement blog post.
If this comes up again (and has not been fixed by 3.9), please open a new issue with a new reproduction. Thank you!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. For general questions, we recommend using StackOverflow or our discord server.
Intended outcome:
When I subscribe, I expect the memory to stay somewhat constant, since the subscription only updates data, and does not add more elements.
Actual outcome:
As soon as I use useSubscription or subscribeToMore the js heap starts building up.
When using the apollo dev tools, I can see that the cache is not growing, and it behaves as expected. It's like the garbage collector doesn't get everything, and somewhere a the subscribed data is persisted.
This simple subscription causes the problem. To get a bigger leak, I've added a picture where I have used the subscription many times.
A repo with the test files can be found here: https://github.com/H-a-w-k/apollo-subscription-heap-growing
Client code:
Server code:
How to reproduce the issue:
Use the repo with the test files can be found here: https://github.com/H-a-w-k/apollo-subscription-heap-growing
or just copy paste the code above and install necessary dependencies. Just start the client and server and start viewing the result in task manager and profiler