Skip to content
This repository was archived by the owner on Oct 7, 2021. It is now read-only.

fix some memory leaks #194

Merged
merged 1 commit into from
Sep 6, 2017
Merged

fix some memory leaks #194

merged 1 commit into from
Sep 6, 2017

Conversation

dirk-thomas
Copy link
Member

This patch fixes some of the memory leaks seen when running the demo_nodes_cpp talker / listener.

Build Status

But there seem to be several more - mostly inside OpenSplice, e.g. the following - maybe @michielb-prismtech has an idea if we are using the API wrong anywhere:

The call to tsMetaHolder->create_datawriter (https://github.com/osrf/opensplice/blob/0941db497e2952ddf69454442071e92e0e69d942/src/api/dcps/c%2B%2B/common/code/Publisher.cpp#L257) in Publisher::create_datawriter allocates memory.

But the corresponding call to deinit (https://github.com/osrf/opensplice/blob/0941db497e2952ddf69454442071e92e0e69d942/src/api/dcps/c%2B%2B/common/code/Publisher.cpp#L375) in Publisher::delete_datawriter seems to never deallocate the memory hence the leak shown in valgrind:

==7156== 352 (248 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 402 of 487
==7156==    at 0x4C2E0EF: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7156==    by 0xAABBCB4: rcl_interfaces::msg::dds_::ParameterEvent_TypeSupportMetaHolder::create_datawriter() (ParameterEvent_Dcps_impl.cpp:45)
==7156==    by 0x9023E83: DDS::OpenSplice::Publisher::create_datawriter(DDS::Topic*, DDS::DataWriterQos const&, DDS::DataWriterListener*, unsigned int) (Publisher.cpp:257)
==7156==    by 0x821FDBC: rmw_create_publisher (rmw_publisher.cpp:160)
...

@dirk-thomas dirk-thomas added the in progress Actively being worked on (Kanban column) label Sep 1, 2017
@dirk-thomas dirk-thomas self-assigned this Sep 1, 2017
@dirk-thomas dirk-thomas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Sep 1, 2017
Copy link
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 👍

@dirk-thomas dirk-thomas merged commit d1d01c5 into master Sep 6, 2017
@dirk-thomas dirk-thomas deleted the fix_memory_leaks branch September 6, 2017 17:45
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Sep 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants