Skip to content

fix: Use default rcl allocator if allocator is std::allocator (backport #3058)#3070

Closed
mergify[bot] wants to merge 1 commit intokiltedfrom
mergify/bp/kilted/pr-3058
Closed

fix: Use default rcl allocator if allocator is std::allocator (backport #3058)#3070
mergify[bot] wants to merge 1 commit intokiltedfrom
mergify/bp/kilted/pr-3058

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Feb 17, 2026

This fixes a bunch of warnings if using ASAN / valgrind on newer OS versions. It also fixed a real bug, as giving the wrong size on deallocate is undefined behavior according to the C++ standard.

This version of the patch keeps the behavior for users that specified an own allocator the same and in therefore back portable.

Alternative to #3054

USED AI:
Yes, chatgpt to generate the template methods to check for the existence of a method on a class in c++17.


This is an automatic backport of pull request #3058 done by Mergify.

* fix: Use default rcl allocator if allocator is std::allocator

This fixes a bunch of warnings if using ASAN / valgrind on newer
OS versions. It also fixed a real bug, as giving the wrong size
on deallocate is undefined behavior according to the C++ standard.

This version of the patch keeps the behavior for users that
specified an own allocator the same and in therefore back portable.

Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>

* feat: Provide a way to suppress the deprecation warning

This commit adds the feature, that the user can now specify a method
rcl_allocator_t get_rcl_allocator() on the given allocator. This method
will be called if present, to get the rcl allocator.
If the method is not present, the code will fall back to the old
(and faulty) implementation and show a deprecation warning.

Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>

---------

Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
Co-authored-by: Janosch Machowinski <j.machowinski@cellumation.com>
(cherry picked from commit 9f79f40)
@fujitatomoya
Copy link
Collaborator

fujitatomoya commented Feb 17, 2026

Pulls: #3070
Gist: https://gist.githubusercontent.com/fujitatomoya/707c9706208a1a6c701573bc729f05a4/raw/94dc9bd57a5af581a100719e279965b5fc757a99/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp
TEST args: --packages-above rclcpp
ROS Distro: kilted
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18225

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@jmachowinski
Copy link
Collaborator

This is the wrong version for the backport, that would create lots of deprecation warnings in kilted

@jmachowinski
Copy link
Collaborator

Correct port : #3071

@ahcorde ahcorde deleted the mergify/bp/kilted/pr-3058 branch February 18, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants