-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
WebSocket Memory Leak on Android and iOS #16732
Comments
+1 ! Very interested in fixing this! |
@kesha-antonov just to be clear. |
@balsloev To be solved. I don't have enough knowledge to fix this |
The issue can finally be resolved. After digging around in the implementation of WebSockets and especially the blobs, I found that all blobs will stay in memory as long as they aren't being directly closed. This means that after you're done with the received data, you should close the Blob like this: ws.onmessage = function (e) {
// Do whatever with the data through e.data.
const data = e.data;
// When you are done with the received data, you must close the Blob:
e.data.close();
}; |
Thanks! |
@SteffenC This is only for Where does the EDIT: Found it in https://github.com/facebook/react-native/blob/master/Libraries/Blob/Blob.js#L119 |
Memory usage through 1:33 minute
Is this a bug report?
Yes.
Have you read the Contributing Guidelines?
Yes.
Environment
Steps to Reproduce
Expected Behavior
I expected the memory usage to increase during the speedtest and then decrease again afterwards.
Actual Behavior
The memory usage increases during the test but never decreases.
Reproducible Demo
App.js
Speedtester.js
Memory usage shown in Instruments
Call tree showing memory usage
The text was updated successfully, but these errors were encountered: