-
Notifications
You must be signed in to change notification settings - Fork 8
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 never freed #46
Comments
Quick answer: it's freed by the garbage collector when no one holds a reference to the shared pointer. But I may be missing something, need to double check. |
Hmm is that really true, the shared pointer is freed, but the buffer allocated need to call free aswell i think?
|
https://en.cppreference.com/w/cpp/memory/shared_ptr
I'm not saying that it's definitely what's happening, that's just an answer to
In reality it may need custom deleter to free up buffer properly. |
Sorry for sounding harsh it was meant as a discussion!
I think so unfortunately: |
Nah, it's ok, I'm at the end of the long day here and just wanted to quickly reply to your initial question, but don't have time right now to check the issue properly. Will try to do it tomorrow. |
The culprit was not The method I used to allocate the buffer for a message was hacky anyway, and I found a proper way to do it. So the PR #47 should also fix issue #27. I tested it with my usual setup with nav2 but there aren't a lot of service calls, especially with strings and string arrays. If possible, please test the PR for such cases. And thanks for providing python script, it was handy to test for leaks. |
Alright great, The compiler is getting smarter! But yes this solution looks much more robust, I guess that the compiler couldn't solve to delete on nested new's then. I will try it out during the day! |
Hi!
Im currently see some issues regarding service calls and memory never gets freed.
Im running a service which will run the async service routine:
{'op': 'call_service', 'id': 'call_service:/ns/my_node/list_parameters:8836', 'service': '/ns/my_node/list_parameters', 'type': 'rcl_interfaces/srv/ListParameters', 'args': {'prefixes': [], 'depth': 0}}
I think its connected with the snippet below.
Were does this buffer get freed, which task is responsible of freeing this memory?
The text was updated successfully, but these errors were encountered: