-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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 in uORB teardown #12537
Comments
We can delete it in Generally with uORB tear-down we need to ensure that no other thread is running anymore that potentially calls an uORB API. |
I tried this patch, but then
So clearly there's more to this story. Maybe in the tests we're passing in literals somewhere? |
Awesome, that fixes it 👍 Dunno how I missed that... I'll add the fix to #12521 |
Each device node knows enough to construct the path on demand. We might be able to structure this to ditch the dynamic allocation entirely. |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
Describe the bug
In the uORBDeviceMaster memory is allocated for the device path and handed to the node, but the node doesn't take ownership of said memory.
Allocated, and if all is successful handed to DeviceNode:
https://github.com/PX4/Firmware/blob/e23e3d7baed6871841911a3aa19812ddb1547b6b/src/modules/uORB/uORBDeviceMaster.cpp#L99
DeviceNode gives it to CDev:
https://github.com/PX4/Firmware/blob/e23e3d7baed6871841911a3aa19812ddb1547b6b/src/modules/uORB/uORBDeviceNode.cpp#L60
which won''t delete it on destruction
https://github.com/PX4/Firmware/blob/e23e3d7baed6871841911a3aa19812ddb1547b6b/src/lib/cdev/CDev.cpp#L62
This isn't an issue on the FCU in real flights, but I'm trying to set up valgrind to find problems in tests, and this is one of them that shows up. It also prevents tearing down and setting up the uORB framework in between unit tests, each test will need to be run in its own process.
The text was updated successfully, but these errors were encountered: