-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
potential memory leak issue in subscription #7775
Comments
Hey @lsping8! Thank you so much for creating a reproduction, and I wanted to tell you I’m looking into this. I tried running your example and I need to look a bit deeper into it, but it seems like Chrome will collect the memory at some point, creating a saw-tooth pattern in terms of memory usage. So my question is, have you noticed the sample application or your actual code crashing from running out of memory? If you haven’t seen this, I’m hesitant to call this a leak, so much as maybe using too much memory. I, of course, could be wrong about this! Also note that if you want more consistent memory usage, the cache abstraction provides some utility methods to reclaim and evict objects as described in the following document https://www.apollographql.com/docs/react/caching/garbage-collection/ Again, thanks for opening this issue, and just wanted to let you know this issue is seen and heard. |
Hi @brainkim, thank you for the reply. To answer your question if the application is crashing, the answer is yes. Well not the sample repo, but the production application we have. Firefox seem to be less tolerance at this issue. As for workaround, we just set all subscription to |
We're seeing similar behavior on our production app as well. We're running Angular with Universal on Heroku. And there's a peak at about 1.5GBs of memory and then it crashes. Tried several patches with various other packages that could've been the culprit, but from our latest findings, seems like Apollo is likely causing it. |
@brainkim Hi, we're also experiencing this issue. Is there any news on that? |
Yup, experiencing this issue HARD on react native |
@israelidanny for React Native, this might be caused by the fact that we have to fall back to normal You can install it with |
The aforementioned change is now included in Apollo Client 3.9 beta - please try it out and give us feedback! :) You can read up more on that in our blog post about the AC 3.9 memory story. |
3.9 has been released, so I will close this issue for now. If this keeps happening in AC => 3.9.0, please open a new issue :) |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
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. |
Hi, I have this test code to test out if Apollo cache is causing the memory leak issue. I have a subscription resolver that will keep publishing at the interval of 10ms .
Intended outcome:
The heap memory in use should not keep increasing and not dropping at all.
Actual outcome:
This screenshot is taken when the page is active for a few minutes, when it's started the heap size is around 30mb.
How to reproduce the issue:
https://github.com/lsping8/apollo-memory-test
I have created this repo to reproduce the issue, clone the repo and follow the setup process. In the app I have added a button to start interval process, click on the
start test
button at the left top corner and monitor the memory in chrome.Versions
System:
OS: Linux 4.15 Ubuntu 16.04.7 LTS (Xenial Xerus)
Binaries:
Node: 12.21.0 - /usr/bin/node
Yarn: 1.22.5 - /usr/bin/yarn
npm: 6.14.11 - /usr/bin/npm
Browsers:
Firefox: 86.0
npmPackages:
@apollo/client: ^3.3.11 => 3.3.11
apollo-server: ^2.21.0 => 2.21.0
apollo-upload-client: ^14.1.3 => 14.1.3
The text was updated successfully, but these errors were encountered: