[Python] ROS2 - Valgrind reports about reachable memory in python nodes

Discussão em 'Python' iniciado por Stack, Julho 21, 2025.

  1. Stack

    Stack Membro Participativo

    I use both python and CPP in my ROS2 project and the fear of memory leaks still remain since my first programming courses, therefore I decided to run the project with valgrind - to check if I have memory leaks in my CPP code.
    Valgrind returned the following:

    ==46166== LEAK SUMMARY:
    ==46166== definitely lost: 0 bytes in 0 blocks
    ==46166== indirectly lost: 0 bytes in 0 blocks
    ==46166== possibly lost: 0 bytes in 0 blocks
    ==46166== still reachable: 748,210 bytes in 1,399 blocks
    ==46166== suppressed: 0 bytes in 0 blocks
    ==46166==
    ==46166== For lists of detected and suppressed errors, rerun with: -s
    ==46166== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)


    I went through all of the logs and none of the leaks are from CPP. All of them are from python, which is very surprising to me as I though python has garbage collection.
    Is this something related to ROS2? Should I be worried about it?
    I could attach the whole log but it is 17056 lines long.

    Update:
    I noticed that I get the same exact "still reachable" even when the CPP node is not even running. Every run returns the same amount of "still reachable".

    Continue reading...

Compartilhe esta Página