-
Notifications
You must be signed in to change notification settings - Fork 90
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 about not to call placement delete
after calling placement new
#219
Comments
@iuhilnehc-ynos thank you for looking into this! I guess I had assumed that:
I may have been thinking of how Cyclone DDS's native code for copying samples out to C applications handles things in making the second assumption. For some background: I borrowed the deserializer code from the dynamic Fast-RTPS RMW implementation some two years ago, hacking it to fit my needs and without ever really diving into the details, and especially without understanding what/when If the destructor does free the memory, the easy solution would be to change the scope of The calls to |
@eboasson
I quickly checked the rmw_fastrtps, and found it still uses
I agree with this. |
Sorry, I lost this important information. And after checking, I think it's the reason why string not deleted. |
Summary of discussion in #224, which works around the issue but doesn't fix the problem.
|
Thanks for your explanation. rmw_cyclonedds/rmw_cyclonedds_cpp/include/rmw_cyclonedds_cpp/TypeSupport_impl.hpp Line 430 in 217259a
I checked the
Currently, these functions(such as, get_function__ParticipantEntitiesInfo__node_entities_info_seq and resize_function__ParticipantEntitiesInfo__node_entities_info_seq) are just defined. There is no function to call them. |
I have checked it. It's working(not to test more, maybe it's not the final patch.). (reverted my previous commit and just use the following patch)
I think this fix belongs to you. |
@iuhilnehc-ynos Do we actually need
|
Me too. I think I need to check the template if all members will define these functions when member matches the condition.(type_id_= |
, if there is a |
My mistake. bool is |
That patch is a good start but:
I probably won't have time to work on a fix til next week, so if somebody else wants to open a PR that would be great. |
A sanity check isn't bad, but in that case the code should fail, as the function pointer being NULL would be unexepected. |
I'd like to make a PR for it.
|
I thinks this was fixed by #228, thanks @iuhilnehc-ynos !! |
Bug report
Required Info:
Steps to reproduce issue
Expected behavior
No memory leak about x = std::string(data + pos, sz - 1); in
cycdeser::deserialize
Actual behavior
Additional information
backtrace of main steps:
new(field) std::string()
assign string (a bit length) into buffer which will cause string::data() be reconstructed.
main sequence
Could somebody give me a suggestion?
This issue is related to ros2/rcl#721, but I think it belongs to rmw_cyclonedds.
The text was updated successfully, but these errors were encountered: