discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Messaging Passing on a Budget


From: Brad Hein
Subject: [Discuss-gnuradio] Messaging Passing on a Budget
Date: Thu, 28 Feb 2019 14:48:35 -0500

 

In my gnuradio test application I’m attempting to pass a JSON formatted string from my C++ custom block, to my python flow graph containing the block.

 

The String message are being received by my python flow graph, but there’s a memory leak. Over time, my flowgraph RSS (memory footprint) grows at about 32k/s up until the application runs out of memory.

 

The leak didn’t start until after I retrofitted my flowgraph and custom block with polymorphic type (PMT) based message passing. I’m passing a 200 or so byte JSON string (as a symbol) from C++ block to python flow graph about 60 times per second.

 

Sleuthing through the pmt.cc code [1] I see the String (symbol) objects are stored in a hash. I suspect what is happening is that since all of my JSON strings are unique, they’re getting added to the hash and causing the hash to grow unbounded over time.

 

From what I can tell by reading the wiki [2], the approach I’m using is the best way to get a string from my custom block and into my python flowgraph.

 

[1] https://github.com/gnuradio/gnuradio/blob/master/gnuradio-runtime/lib/pmt/pmt.cc

[2] https://www.gnuradio.org/doc/doxygen/page_pmt.html

 

 

Sample c++ block code snippet from my work function:

 

// Calculate metrics. Occasionally (60/second) we'll get back a JSON formatted string of metrics.

crossingData = calculateWaveCrossingMetrics(lastSampleValue,in[i]);

 

if (crossingData.length() > 0) {

  pmt::pmt_t messageString;

  messageString = pmt::string_to_symbol(crossingData.c_str());

  message_port_pub(polymorphicMessageDestination, messageString);

 

 

Questions:

 

1.     Is this the best way to get a string from my C++ block into my python application?

2.     Is there a way to pass my messages that doesn’t result in memory growing unbounded?

 

 

Thank you

Brad

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]