Skip to content
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

[BUG] memory leak in connext_dds/listeners example #603

Open
franciscoRTI opened this issue Mar 10, 2023 · 0 comments
Open

[BUG] memory leak in connext_dds/listeners example #603

franciscoRTI opened this issue Mar 10, 2023 · 0 comments
Labels
bug Bugs or inconsistencies in the examples unconfirmed The bug was not confirmed yet

Comments

@franciscoRTI
Copy link

System information

  • RTI Product:
  • Version: 7.1.0
  • Operating system: Linux
  • Compiler: gcc
  • Compiler version: 11.0.0
  • Additional information:

What is the current behavior?

Memory leak

Steps to reproduce the issue

Compile example examples/connext_dds/listeners

Run publisher and/or subscriber with option -c 2 using valgrind. A memory leak is reported.

Expected behavior

There should not be any memory leak.

Suggested solutions

The problem is that in the publisher

DataWriterListener *writer_listener = new DataWriterListener();

is never released. And in the subscriber

ParticipantListener *participant_listener = new ParticipantListener();
ReaderListener *reader_listener = new ReaderListener();
SubscriberListener *subscriber_listener = new SubscriberListener();

are never released.

Also for consistency, the sub application checks for null pointer after creating the listeners, but the pub application does not check for this. After creating the DW listener we should add the following:

    DataWriterListener *writer_listener = new DataWriterListener();
    **if (participant_listener == NULL) {
        std::cerr << "participant listener instantiation error" << std::endl;
        return EXIT_FAILURE;
    }**

Note : in the subscriber if the DR listener can not be created the application will terminate gracefully with a memory leak because the participant and the subscriber listeners are not deleted.

@franciscoRTI franciscoRTI added bug Bugs or inconsistencies in the examples unconfirmed The bug was not confirmed yet labels Mar 10, 2023
@lulivi lulivi changed the title [BUG] [BUG] memory leak in connext_dds/listeners example Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs or inconsistencies in the examples unconfirmed The bug was not confirmed yet
Projects
None yet
Development

No branches or pull requests

1 participant