rticommunity / rticonnextdds-connector

RTI Connector for Connext DDS is a lightweight technology that enables DDS data to be accessed with Javascript (Node.js), Python, and Lua.
Other
56 stars 33 forks source link

Memory leak when running reader.py example (CON-49) #53

Closed WimPessemier closed 6 years ago

WimPessemier commented 7 years ago

Hi, I'm experiencing the exact same behavior as https://github.com/rticommunity/rticonnextdds-connector/issues/42 (but cannot re-open the issue due to missing rights). Simply running the example with many squares gives the memory profile as in the attached image. Has anyone else seen this behavior? Thanks! memory_profile

gianpiero commented 7 years ago

Hello @WimPessemier ,

Thanks for sharing this. I want to look into this. Can you share what method are you using to capture memory leaks?

WimPessemier commented 7 years ago

Hi, We used the memory profiler https://pypi.python.org/pypi/memory_profiler But if you use top (in Linux) or task manager (Windows) you should also see the memory increasing after a few minutes. Thanks for looking into this!

gianpiero commented 7 years ago

Hello @WimPessemier,

Sorry for the late response. As you may know, the connector has been developed by the research group in RTI and is not an officially supported product. That being said we offer 'community' support. That means here and on the community forum but in a 'best effort' manner.

We did our best to find some time to work on this and we were able to identify the memory leak. We created an internal bug (CON-49) and we will try to address this bug for the next release.

We implemented a temp solution that we hope you can try. Please replace the file named rticonnextdds_connector/rticonnextdds_connector.py with this one.

The reason why I call this a temp solution, is because we would like to implement a more efficient one that loans the string to the scripting layer and then the scripting layer will return the loan. That solution is not hard per se but requires changes to the c library.

Our tests show that the temp solution we are providing for python works. This is the mem chart before:

before_fix

and this is the chart right after we apply the fix:

after_fix

We tested on darwin and linux 64. Let us know if this fix solves your issue.

Thanks again for evaluating and providing feedback for our experimental product.

Best Regards, Gianpiero

gianpiero commented 6 years ago

This issue has been fixed first in the leaks branch and now has been merged in the master with version number 0.3.2