4.2. Memory Performance¶
4.2.1. Heap Benchmarks¶
The “Heap” section provides information about how much dynamically allocated memory is used by Connext Micro. It should be noted that exact numbers are very difficult to estimate and that the numbers are only for guidance. Please refer to the Resource Module in the Connext Micro C API documentation 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.
4.2.1.1. Heap Usage¶
The following table shows how much memory each resource-limit uses in the memory model for the x86_64leElfgcc7.3.0-Linux4 architecture.
Entity |
Size (Bytes) |
---|---|
DomainParticipantFactory |
5080 |
max_participants |
57690 |
max_components |
N/A |
local_topic_allocation |
296 |
local_type_allocation |
88 |
local_publisher_allocation |
1304 |
local_subscriber_allocation |
1288 |
local_reader_allocation |
5980 |
local_writer_allocation |
6216 |
matching_writer_reader_pair_allocation |
80 |
remote_participant_allocation |
9882 |
remote_writer_allocation |
1276 |
remote_reader_allocation |
1364 |
max_destination_ports |
215 |
max_receive_ports |
783 |
(DataReader) max_instances |
424 |
(DataReader) max_samples |
308 |
(DataReader) max_remote_writers |
1904 |
(DataReader) max_routes_per_writer |
168 |
(DataReader) max_samples_per_instance |
0 |
(DataReader) max_remote_writers_per_instance |
0 |
(DataReader) max_samples_per_remote_writer |
0 |
(DataWriter) max_instances |
128 |
(DataWriter) max_samples |
1280 |
(DataWriter) max_remote_readers |
536 |
(DataWriter) max_routes_per_reader |
168 |
(DataWriter) max_samples_per_instance |
0 |
DPSE Discovery Plugin |
34553 |
DPDE Discovery Plugin |
199827 |
NETIO_DGRAM Transport Plugin |
2327 |
Notes:¶
max_participants: This is the memory for an empty participant. The memory used by each entity must be added as described for each entity.
local_topic_allocation: Add
strlen(topic_name)
+ 1local_type_allocation: Add
strlen(type_name)
+ 1local_reader_allocation: The sample and instance resources must be added.
local_writer_allocation: The sample and instance resources must be added.
remote_writer_allocation: This includes the
topic_name
.remote_reader_allocation: This includes the
topic_name
.
Calculating Memory Usage for DDS Entities¶
The following short-hands are used in these formulas:
rl_ms
- resource_limits.max_samplesrl_mi
- resource_limits.max_instancesrl_mrw
- datareader_resource_limits.max_remote_writersrl_mrpw
- datareader_resource_limits.max_routes_per_writerwrl_mrw
- datawriter_resource_limits.max_remote_readerswrl_mrpr
- datawriter_resource_limits.max_routes_per_reader
Type¶
(36) + string.len(type_name) + 1
Topic¶
(140) + string.len(topic_name) + 1
DDS DataReader¶
(2285) + (rl_ms * 160 ) + (rl_mi * 271) + (rl_mrw * 391) + (rl_mrpw * 87)
DDS DataWriter¶
(2727) + (rl_ms * 116) + (rl_mi * 79) + (wrl_mrr * 391) + (wrl_mrpr * 87)
RemoteParticipant¶
(remote_participant_allocation) + (16 * 24)
RemotePublication¶
(remote_writer_allocation) + string.len(topic_name) + 1 + (16 * 24)
RemoteSubscription¶
(remote_reader_allocation) + strlen(topic_name) + 1 + (16 * 24)
4.2.1.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 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).
4.2.1.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 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).