Open stevewolter opened 4 years ago
Thanks for bringing up this issue. After reading the documentation, I agree with both of your points. I'd be OK with removing this implementation entirely and just using the default rcl allocator for now instead. But pinging @ros2/team for other opinions.
Yeah we can just remove it, I think it should be fixable, but I don't think anyone is really using it and we plan to move to the polymorphic allocator (we think) in the future anyways, so we can fix it then.
Great, thanks for the feedback. @stevewolter if you are interested in working on this, we'll be happy to review. Thanks.
Thanks Chris, I'll give it a shot and send a PR.
Quick update: It will be some time - I'm on vacation for 2 weeks now, but I'll send a PR afterwards.
@stevewolter Thanks for the heads up.
OK, this will take 4 commits to sort out. I'll first make get_rcl_allocator into a family of freestanding functions instead of a function template with explicit instantiation, so that current users of allocators (tlsf_cpp, demo_node) can add overrides for their custom allocators. Then I'll add these overrides, and finally delete the generic allocator implementation that causes the UB.
First PR https://github.com/ros2/rclcpp/pull/1324 is ready for review. Chris, could you PTAL?
rclcpp/include/rclcpp/allocator/allocator_common.hpp has two severe correctness issues in memory allocation:
I realize that both of these issues are not easily fixable. Since allocators are not supported yet anyway (#1061), I'd suggest to disable support for custom allocators entirely and depend on the default RCL allocator. If you concur, I'd be happy to help in implementation.