Skip to content

Define get_rcl_allocator() for the custom allocator tutorial - #823

Merged
christophebedard merged 1 commit into
rollingfrom
christophebedard/custom-allocator-get-rcl-allocator
Nov 27, 2026
Merged

christophebedard merged 1 commit into
rollingfrom
christophebedard/custom-allocator-get-rcl-allocator

Conversation

@christophebedard

@christophebedard christophebedard commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Description

rclcpp is removing the deprecated conversion of C++ allocators to rcl allocators, so allocators other than std::allocator<void> need to define rcl_allocator_t get_rcl_allocator(), as recommended since ros2/rclcpp#3058 (Lyrical). This allocator uses malloc() and free(), so its rcl allocator can count calls and forward them.

Is this user-facing behavior change?

Did you use Generative AI?

Claude Opus 5.5 to make this change.

Additional Information

Needed for ros2/rclcpp#3445, which removes this deprecated conversion. Merge this one first.

`rclcpp` is removing the deprecated conversion of C++ allocators to
rcl allocators, since it is not valid, so allocators other than
`std::allocator<void>` need to define `rcl_allocator_t
get_rcl_allocator()`, as recommended since
ros2/rclcpp#3058 (Lyrical). This allocator
uses `malloc()` and `free()`, so its rcl allocator can count calls and
forward them.

Signed-off-by: Christophe Bedard <[email protected]>
@ahcorde

ahcorde commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Pulls: #823
Gist: https://gist.githubusercontent.com/ahcorde/b7c4fd485809bd72f672ddff15c6e3d7/raw/b770e67dd33a667574793858af0220b8052f1275/ros2.repos
BUILD args: --packages-above-and-dependencies demo_nodes_cpp
TEST args: --packages-above demo_nodes_cpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/21331

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

@christophebedard
christophebedard merged commit 092e426 into rolling Nov 27, 2026
3 checks passed
@christophebedard
christophebedard deleted the christophebedard/custom-allocator-get-rcl-allocator branch November 27, 2026 17:57
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.

2 participants