-
Notifications
You must be signed in to change notification settings - Fork 89
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
Use init-on-first-use for global state #275
Conversation
Otherwise global destructor ordering can result in the global state being destroyed before the last use. Not cleaning up does cause a small memory leak at shutdown, but it is limited to an empty map of domains and an empty unordered set of waitsets. Signed-off-by: Erik Boasson <eb@ilities.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks OK to me. There's one style error inline I've pointed out.
I also think we should add a comment above the gcdds()
function explaining why we are doing this and the tradeoff of never calling the destructor. That will help future readers understand.
Finally, a CI run with this in place, both with and without ros2/rmw#293, would be good to ensure that the problem there is solved.
Signed-off-by: Erik Boasson <eb@ilities.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I'm going to go ahead and run full CI on this both for the current state of the world, and in combination with ros2/rmw#293 to make sure things are happy.
CI with this PR and ros2/rmw#293: |
All right, looking at the CI results with just this PR in place:
So as far as I can tell this PR is ready to go. I'm going to go ahead and merge, thanks @eboasson ! |
* Use init-on-first-use for global state Otherwise global destructor ordering can result in the global state being destroyed before the last use. Not cleaning up does cause a small memory leak at shutdown, but it is limited to an empty map of domains and an empty unordered set of waitsets. Signed-off-by: Erik Boasson <eb@ilities.com>
* Use init-on-first-use for global state Otherwise global destructor ordering can result in the global state being destroyed before the last use. Not cleaning up does cause a small memory leak at shutdown, but it is limited to an empty map of domains and an empty unordered set of waitsets. Signed-off-by: Erik Boasson <eb@ilities.com>
Otherwise global destructor ordering can result in the global state being
destroyed before the last use. Not cleaning up does cause a small memory leak
at shutdown, but it is limited to an empty map of domains and an empty
unordered set of waitsets.
Signed-off-by: Erik Boasson eb@ilities.com