Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Just to make sure we are on the same page here, loaning and releasing does not correspond to new/delete and memory allocations. It's really just a signal to the middleware to gain and release ownership over a junk of memory (previously) allocated by the middleware.

Can I ask why do you think borrowing and releasing a loaned message is not desired? Off the top of my head I don't see any other possibility to send a message via zero-copy transport without explicitly releasing the pointer back to the middleware. By not doing so, how could one secure the integrity of the message on the subscription side? That is, not modifying the message data after a call to publish.

The idiom with loaned messages is that the middleware, opposed to the user application, is handling all memory allocations. In the case of Iceoryx, that would essentially be its managed shared memory. I think what you are trying to do is some sort of DMA where the user application provides access to externally located memory. This is not possible with the current API design for loaned messages. You still would have to loan an appropriately sized message from the middleware and copy your camera ringbuffer into the loaned message. However, there wouldn't be any other copy involved as the message which arrives at the subscription side is not copied but also just loaned. So in your case there is really just one copy from your camera to the message, but no second one.