Using shared memory (SHM) in ROS 2 Humble with CycloneDDS and iceoryx allows processes on the same machine to exchange data without network stack overhead. This mechanism maps physical memory pages into the address spaces of multiple processes, enabling faster communication compared to standard UDP-based DDS transport.

The implementation relies on Eclipse iceoryx, which uses a chunk-based memory pool system. Publishers write data into shared memory segments, and subscribers receive pointers to these chunks. While this avoids network fragmentation and system calls, developers must distinguish between simple memory copying and zero-copy 'loaned' messages.

True zero-copy performance requires using POD (Plain Old Data) types and the borrow_loaned_message() function. For non-POD types, such as those containing strings or headers, the system performs serialization into the shared memory chunk, which remains faster than network transmission but still incurs CPU costs for serialization.

Configuration requires running the RouDi daemon before starting ROS 2 nodes. Users must manage memory pools via TOML files, specifying chunk sizes and counts. Proper setup involves setting environment variables like CYCLONEDDS_URI and ensuring that the ROS_DISABLE_LOANED_MESSAGES variable is set to 0 to enable loaned message support.

Intra-process communication (IPC) remains the fastest method for nodes within a single process, using pointers directly. However, SHM is the preferred solution for high-performance data exchange between separate processes on a single host, and these two approaches can be combined for complex architectures.