-
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
Memory leak with Apollo Client in react native on iOS #9079
Comments
The example above is on a mutation, but it also happens on query
Once getUserBalance is called I get the same results. |
@otusweb Just so everything's up-to-date, can you try updating to I have no real basis for this conjecture, but I have a hunch it may be time to retire the React Native exception for |
@benjamn I updated and tried changing Unfortunately, this did not solve our issue. |
An extra piece of information is that it is only reproducible in release builds. The memory footprint is stable while using debug release. |
Turns out this is not due to Apollo, but something we were doing in one of our middleware. |
Intended outcome:
Run the application without a quickly increasing memory footprint causing the OS to kill the app
Actual outcome:
The memory footprint of the app quickly grows until the system decides to kill the application. Looking at the profiling information from Instruments, it looks like little chunk of 112 bytes are being allocated quickly and causing the memory usage to spin out of control
How to reproduce the issue:
Code
Note i'm new to this codebase and while a little familiar with Apollo, i'm by no mean an advanced user :-) So feel free to let me know if you need more info.
In a react native app.
Update user mutation
Run the app from Xcode by selecting Product > Profile
Once the method
processUser
is called, the memory footprint start to grow and the app crashes within 30s to 1 minute.The image below shows the allocation of those 112 bytes of memory chunk over 25 seconds until the app is killed
Looking at where this memory is allocated shows the following stack trace (some are from different places, but 99% is from this place):
Versions
System:
OS: macOS 11.6
Binaries:
Node: 16.11.1 - ~/.nvm/versions/node/v16.11.1/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v16.11.1/bin/yarn
npm: 7.24.2 - ~/Projects/AppChoose/node_modules/.bin/npm
Browsers:
Chrome: 95.0.4638.69
Safari: 15.0
npmPackages:
@apollo/client: 3.4.15 => 3.4.15
I also tried to downgrade to 3.4.0, with no luck
I'm unsure if this is related to #8903 or not
The text was updated successfully, but these errors were encountered: