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 when subscribing to messages containing UInt8Array #842
Comments
Thanks for your feedback, rclnodejs replaced one of its dependencies, |
I am unable to reproduce on v0.20.1 and node 12. I performed the test using the project attached to the original message. After 750 messages, the RSS size was ~200MB. I repeated the same test with v0.21.0 and node 16 and, after 750 messages, the RSS size was ~950MB |
Thanks for testing it! So I am pretty sure it is the change of |
This patch fixed the memory leak when using typed arrays on nodejs > 10 Fix: #842
This patch fixed the memory leak when using typed arrays on nodejs > 10 Fix: #842
@tytremblay please try with the latest 0.21.1 to check if the issue is gone, thanks! |
Thank you! The issue seems to be resolved. I updated to 0.21.1 and ran the above project. After 2000 messages, the RSS Size was ~200MB as expected. |
@tytremblay good to know and thanks for your feedback! |
Ty for the fix. Good job man. |
This patch fixed the memory leak when using typed arrays on nodejs > 10 Fix: #842
Description
It seems memory is not getting released for subscribers subscribing to messages containing a UInt8Array. If a sufficiently large array is published, the memory of the Node.js process can grow very quickly.
Steps To Reproduce
Attached is a small nodejs example of the issue I'm seeing. In the example, I have set up a publisher to publish a large image every 100ms. I've set up a subscriber to subscribe to that topic, and print
process.memoryUsage().rss
each time it receives a message.The example can be run by running
npx ts-node server.ts
in a terminal window andnpx ts-node client.ts
in another window.When both are running, you can see that the memory footprint of the node process running the client grows whenever a message is received.
Expected Behavior
Memory should not grow with each message
Actual Behavior
Memory grows with each message
rosleak.zip
The text was updated successfully, but these errors were encountered: