How to setup ROS2 Foxy and Fast DDS for minimum memory usage

By default Fast DDS pre-allocates some memory at start-up to avoid dynamic memory allocations increasing the performance. The main advantage of this default is having real-time behavior and the minimum latency for typical cases. While this is fine for most use cases, sometimes the user needs to use the minimum memory possible for his use case.

There are several QoS you can use to set-up Fast DDS for minimum memory usage, for example, you can set MemoryManagementPolicy to DYNAMIC_RESERVE_MEMORY_MODE to reserve memory just when it is required, ensuring that way the lowest memory footprint at any moment.

There is a complete tutorial on how to set up Fast DDS for minimum memory usage here

3 Likes

Hi @MiguelCompany,

And also it is worth to comment: when you really need a very low footprint then you should use Micro-ROS

We posted a Micro-ROS memory profiling here