DDS_DynamicData::set_octet_seq() returns DDS_RETCODE_OUT_OF_RESOURCES

3 posts / 0 new
Last post
Last seen: 12 years 8 months ago
Joined: 10/28/2011
Posts: 2
DDS_DynamicData::set_octet_seq() returns DDS_RETCODE_OUT_OF_RESOURCES

I have initialized a data type dynamically which contains, among various basic types, an octet sequence member which may be up to 100000 elements long. The type registrating code is shown below.


structMembers[...].name = DDS_String_dup("aData");
structMembers[...].type = pTypecodeFactory->create_sequence_tc(100000, pTypecodeFactory->get_primitive_tc(DDS_TK_OCTET), ex);


Now I want to transmit some data over DDS later. The surrounding code looks like this:


DDS_OctetSeq os;

// the char* pData contains the data to send, and nSize is the size of that buffer
os.loan_contiguous((DDS_Octet*) pData, nSize, nSize);
nRetcode = pDdsDynamicDataSample->set_octet_seq("aData", DDS_DYNAMIC_DATA_MEMBER_ID_UNSPECIFIED, os);

// make a DDSDynamicDataWriter and actually send the data



This code works and the data does arrive at the intended subscriber, but for some reason whenever the nSize goes above roughly 63 KB the set_octet_seq() call will return DDS_RETCODE_OUT_OF_RESOURCES. Why won't DDS increase the size of the octet sequence over that limit, and where can I change this? Thank you in advance.

Gerardo Pardo's picture
Last seen: 1 month 1 week ago
Joined: 06/02/2010
Posts: 602

This could be an issue with how the DDS_DynamicData is registered / constructed.  When you construct the type support it takes a 'properties' argument of type DDS_DynamicDataTypeProperty_t

Within this structure there are settings that control the maximum size of the data storage and the serialization buffer. The default values of these are quite small (64KB) which would explain what you are seeing.


I think what you need is to increase the maximum size to some arge number. For example 1MB. I would not worry that this number is much larger than the 100KB that you need as it will only be allocated to the size that it needs. The maximum size just prevents it from growing beyond that hard limit.


To sum it up you need something along the lines of:

DDS_DynamicDataTypeProperty_t properties; = 100; = 1000000;
properties.serialization.use_42e_compatible_alignment = DDS_BOOLEAN_FALSE;
properties.serialization.max_size_serialized = 1000000;
typeSupport = new DDSDynamicDataTypeSupport(type,  &properties);

Last seen: 12 years 8 months ago
Joined: 10/28/2011
Posts: 2

Ah I see, I didn't know that. I will try this solution out. Thank you very much!