Jump to content
OpenSplice DDS Forum
aaron.panella

DCPS (isocpp2) gradually uses more memory over time

Recommended Posts

Hi all,

I am a bit new to DDS/OpenSplice - I've written a transmitter and receiver that streams video using pub/sub (I'm not using OpenSplice Streams though, just DCPS). It all seems to work perfectly, however, when it is running over a long period of time, for the reader application, the memory usage will increase in every thread, until the kernel OOM kills my application. This smells like a memory leak but I checked it with valgrind and it seems fine. Additionally, stopping the data stream frees up the memory, so if it was leaking I wouldn't expect that to happen.

I've set up my QoS as best I can, in order to achieve what I like. I want max throughput, and don't care if I drop a sample or two along the way. So I've set to volatile so that dropped samples aren't stored anywhere, but I suspect somewhere, some stuff is being stored in memory.

So anyway, I suspect that this is just a QoS/configuration issue - are there any QoS policies I may have missed that could cause this to occur? Here are the ones I've configured in my initializer list, I guess all other policies would be using the defaults:
 

reader_topic_qos_{dp_.default_topic_qos()

<< dds::core::policy::Durability::Volatile()

<< dds::core::policy::Lifespan(dds::core::Duration(1,0))

<< dds::core::policy::Liveliness(dds::core::policy::LivelinessKind::AUTOMATIC ,dds::core::Duration(1,0))

<< dds::core::policy::ResourceLimits(10)

<< dds::core::policy::Reliability::BestEffort()},

Thanks for your time

Edited by aaron.panella
code format

Share this post


Link to post
Share on other sites

Hi Aaron,

Just a quick question: are you using a keyed topic? And are you monotonically increasing your key values for every sample you write? Because in that case you are indeed leaking your instances away. An instance remains available in your reader cache until the Writer decides to unregister that instance, either explicitly (using the unregister_instance operation) or implicitly (by deleting the Writer itself). Can you let us know if this was indeed your scenario and if the suggested fix works for you?

Regards,

Erik Hendriks.

Share this post


Link to post
Share on other sites

Hi Erik,

Thanks for the quick reply.

Actually yes, I am using a keyed topic, and yes, I am generating the key from an unsigned short "id", which I am incrementing each time I send a new sample. My writer exists for the lifetime of my application, so it sounds like you are right. I will use the unregister_instance operation first thing tomorrow and report back. Thanks once again

Best Regards,

Aaron

Share this post


Link to post
Share on other sites

Hi Aaron,

Although unregistering your instance will probably do the job here, it might also double your network traffic, since each instance is now being created (by writing your sample), and then being unregistered (the unregister_instance operation writes a so called unregister message, that might have a similar footprint as your first message).

If you are only using DDS as a stream, then do you really need to use monotonically increasing keys? You could make the topic keyless (just use a #pragma keylist with an empty keylist), which results in a singleton instance. Every sample you write then belongs to this singleton instance, and so you don't need to do any additional unregistering per sample. However, you might need to switch to KEEP_ALL on both your Reader and your Writer to make sure that older samples are not pushed out of your Reader/Writer cache by newer samples.

Regards,

Erik Hendriks. 

Share this post


Link to post
Share on other sites

Thanks Erik,

There is no real reason for me to use keys here, I'm really only using one topic instance per topic type, one publisher, one subscriber. I will change to keyless topics and KEEP_ALL

Best Regards,

Aaron

Edited by aaron.panella
clarity

Share this post


Link to post
Share on other sites

Hi Erik,

I've finally got back around to this issue - I replaced my keyed topics with keyless topics. After some initial issues receiving (incorrectly configured viewstate) I managed to get my application working again. It seems as though it is no longer leaking. I will leave it running in the background and monitor it, but I believe you've provided me with the fix to this issue. Thank you for taking the time to provide me with more insight into OpenSplice

Best Regards,

Aaron

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...