DDS_DynamicData::set_octet_seq() returns DDS_RETCODE_OUT_OF_RESOURCES

3 posts / 0 new
Last post
Offline
Last seen: 12 years 5 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);
os.unloan();

// 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
Offline
Last seen: 2 weeks 5 days ago
Joined: 06/02/2010
Posts: 601

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;
properties.data.buffer_initial_size = 100;
properties.data.buffer_max_size = 1000000;
properties.serialization.use_42e_compatible_alignment = DDS_BOOLEAN_FALSE;
properties.serialization.max_size_serialized = 1000000;
typeSupport = new DDSDynamicDataTypeSupport(type,  &properties);

Offline
Last seen: 12 years 5 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!