Files
boost_mqtt5/doc/qbk/08_allocators.qbk
T
Korina Šimičević c7a4fcd507 Add a chapter on asio compliance - allocators
Summary: related to T12804

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28543
2024-03-21 08:31:23 +01:00

23 lines
1.3 KiB
Plaintext

[section:allocators Allocators]
Every asynchronous operation has an associated allocator
designed to provide the operation with a consistent and stable memory source for the duration of its execution.
This allocated memory, referred to as per-operation stable memory resources (POSMs),
remains retained for the lifetime of the operation, ensuring its availability whenever needed.
Asynchronous operations may utilise POSMs in numerous ways.
See __ASIO_ALLOCATORS__ and __ASIO_CUSTOM_MEMORY_ALLOCATION__ for more information.
The __Client__ supports and utilises allocators associated with `async_xxx`'s handlers
to store the state associated with the operation.
Specifically, the allocator is used to reserve memory for MQTT Control Packet bytes
(__PUBLISH__, __SUBSCRIBE__,...) created by each `async_xxx` operation request.
Moreover, the __Client__'s internal packet queue
(described in the section ['Efficient bandwidth usage with packet queuing] in [link async_mqtt5.optimising_communication Optimising communication])
associates the allocator of the first packet in the queue to the low-level __Asio__ function
`async_write` on the transport layer.
Lastly, the __Client__ uses [@boost:doc/html/boost_asio/reference/recycling_allocator.html `boost::asio::recycling_allocator`]
to allocate memory for its internal operations and components.
[endsect][/allocators]