9.3. Heap Benchmarks¶
The “Heap” section provides information about how much dynamically allocated memory is used by Connext DDS Micro. It should be noted that exact numbers are very difficult to estimate and that the numbers are only for guidance. Please refer to ResourceModule for a more information on resource-limits and memory usage.
On Linux, for each heap allocation using malloc, malloc_usable_size() is called to determine the actual size of each allocation. The numbers include resources used by the RH_SM, WH_SM, and UDP components, but not the resources used by the dynamic discovery component (DPDE) or the static discovery component (DPSE). In addition, please note that the memory does not include memory for the actual user-data. This must be added according to the resource-limits. The numbers are for the release libraries.
The size for entities that are controlled by resource-limits are provided. In addition, a formula is provided to estimate the amount of memory used by a data reader and data writer as these are typically the ones that consume most of the memory.
9.3.1. Heap Usage¶
The following table shows how much memory each resource-limit in the memory model
Resource-limit | Size in Bytes | Notes |
---|---|---|
DomainParticipantFactory | 2184 | |
max_participants | 13712 | This is the memory for an empty participant. The memory used by each entity must be added as described for each entity. |
max_components | N/A | |
local_topic_allocation | 116 | Add strlen(topic_name) + 1 |
local_type_allocation | 12 | Add strlen(type_name) + 1 |
local_publisher_allocation | 268 | |
local_subscriber_allocation | 268 | |
local_reader_allocation | 2184 | The sample and instance resources must be added. |
local_writer_allocation | 2595 | The sample and instance resources must be added. |
matching_writer_reader_pair_allocation | 28 | |
remote_participant_allocation | 500 | |
remote_writer_allocation | about 600 | This includes the topic_name |
remote_reader_allocation | about 600 | This includes the topic_name |
max_destination_ports | 77 | |
max_receive_ports | 360 | |
(DataReader) max_instances | 271 | |
(DataReader) max_samples | 160 | |
(DataReader) max_remote_writers | 391 | |
(DataReader) max_routes_per_writer | 87 | |
(DataReader) max_samples_per_instance | 0 | |
(DataReader) max_remote_writers_per_instance | 0 | |
(DataReader) max_samples_per_remote_writer | 0 | |
(DataWriter) max_instances | 79 | |
(DataWriter) max_samples | 116 | |
(DataWriter) max_remote_readers | 391 | |
(DataWriter) max_routes_per_reader | 87 | |
(DataWriter) max_samples_per_instance | 0 | |
max_locators_per_discovered_participant | 83 | |
max_buffer_size | 0 | |
max_message_size | 0 | |
matching_reader_writer_pair_allocation | 0 |
9.3.1.1. Calculating Memory Usage for DDS Entities¶
The following short-hands are used in these formulas:
- rl_ms - resource_limits.max_samples
- rl_mi - resource_limits.max_instances
- rl_mrw - datareader_resource_limits.max_remote_writers
- rl_mrpw - datareader_resource_limits.max_routes_per_writer
- wrl_mrw - datawriter_resource_limits.max_remote_readers
- wrl_mrpr - datawriter_resource_limits.max_routes_per_reader
9.3.1.1.1. Type¶
(13) + string.len(type_name) + 1
9.3.1.1.2. Topic¶
(117) + string.len(topic_name) + 1
9.3.1.1.3. DDS DataReader¶
(2184) + (rl_ms * 160 ) + (rl_mi * 271) + (rl_mrw * 391) + (rl_mrpw * 87)
9.3.1.1.4. DDS DataWriter¶
(2595) + (rl_ms * 116) + (rl_mi * 79) + (wrl_mrr * 391) + (wrl_mrpr * 87)
9.3.1.1.5. RemoteParticipant¶
(501) + (16 * 24)
9.3.1.1.6. RemotePublication¶
(149) + string.len(topic_name) + 1 + (16 * 24)
9.3.1.1.7. RemoteSubscription¶
(173) + strlen(topic_name) + 1 + (16 * 24)
9.3.2. Dynamic Discovery (DPDE) Heap Usage Information¶
The DPDE plugin is a DDS application that advertises locally created DDS entities and listens for DDS entities available in the DDS data-space. It is implemented using the DDS APIs supported by Connext DDS Micro.
The DPDE plugin creates the following DDS entities:
- One DDS Publisher
- One DDS Subscriber
- Three DDS Topics
- Three DDS DataReaders
- Three DDS DataWriters
The DPDE plugin also registers the following three types:
- DDS_ParticipantBuiltinTopicData
- DDS_PublicationBuiltinTopicData
- DDS_SubscriptionBuiltinTopicData
All heap memory allocated by the DPDE plugin is allocated after the DDS DomainParticipant is created (no additional memory is allocated after the DDS DomainParticipant is enabled).
DPDE Plugin | Release Size(B) |
---|---|
Plugin | 65560 |
9.3.3. Static Discovery (DPSE) Heap Usage Information¶
The DPSE plugin is a DDS application that only advertises locally created DDS DomainParticipants and listens for other DDS DomainParticipants available in the DDS data-space. It is implemented using the DDS APIs supported by Connext DDS Micro.
The DPSE plugin creates the following DDS entities:
- One DDS Publisher
- One DDS Subscriber
- One DDS Topics
- One DDS DataReader
- One DDS DataWriter
The DPSE plugin also registers the following type:
- DDS_ParticipantBuiltinTopicData
All heap memory allocated by the DPSE plugin is allocated after the DDS DomainParticipant is created (no additional memory is allocated after the DDS DomainParticipant is enabled).
DSDE Plugin | Release Size(B) |
---|---|
Plugin | 31644 |