[ros-users] [Discourse.ros.org] [Next Generation ROS] Heap Allocator in ROS
William Woodall
ros.discourse at gmail.com
Thu Sep 14 00:42:12 UTC 2017
[quote="sagniknitr, post:1, topic:2630"]
What is the default heap allocator in ROS ?
[/quote]
In ROS 1 and ROS 2 the default allocators (new/delete, which are based on malloc and free) are not overridden by default.
In ROS 1 you can provide your own C++ style allocator for messages, but that's about it.
In ROS 2 you can provide your own C++ style allocator for messages, publishers, subscribers, and the executor (the thing that does `spin()`). You can also provide a custom allocator when using the C api's in ROS 2, using an allocator struct, but the default again uses malloc and free.
[quote="sagniknitr, post:1, topic:2630"]
How is it different in case of nodelets/components used in ros 2 ?
[/quote]
There are no nodelets in ROS 2, but you can compose multiple nodes into a single process in ROS 2, like you could with nodelets in ROS 1.
Composition of nodes, whether by nodelets in ROS 1 or with normal Nodes in ROS 2, has no bearing on the use of the default or custom allocators. The decision is orthogonal as far as I can see.
---
[Visit Topic](https://discourse.ros.org/t/heap-allocator-in-ros/2630/2) or reply to this email to respond.
More information about the ros-users
mailing list