[prev in list] [next in list] [prev in thread] [next in thread]
List: usrp-users
Subject: Re: [USRP-users] UHD and Memory leak
From: Marcus_Müller via USRP-users <usrp-users () lists ! ettus ! com>
Date: 2016-01-29 8:29:53
Message-ID: 56AB2301.6020202 () ettus ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi John,
we're actively investigating this, but haven't been able to reproduce
your specific rate (or at least the same linear behaviour) of memory
usage growth; we do indeed see an increase of memory usage over time,
but that might as well be libc doing its memory allocations prefering
speed over minimized usage.
As I said, still investigating.
Best regards,
Marcus
On 01/29/2016 05:02 AM, john liu via USRP-users wrote:
> Hi,Martin,
> To the question, do you have some conclusions or suggestions?
> Cheers,
> John
>
> On Tue, Dec 29, 2015 at 10:17 AM, Martin Braun <martin.braun@ettus.com
> <mailto:martin.braun@ettus.com>> wrote:
>
> Thanks, John,
>
> I hope we can find time soon to look into this. Thanks for sending
> this!
>
> Cheers,
> Martin
>
> On 27.12.2015 17:15, john liu wrote:
> > hi,martin,
> > I am so sorry to reply you so late.
> > and thank you for reply.
> > we take frequency hopping in vs2010+windows7,and we do nothing
> > but frequency hopping.
> > here is our test code:
> >
> > namespace po = boost::program_options;
> >
> > long arryArryAntParam[][4] = {
> > {101700000, 8000000, 16000000, 20},
> > //{102600000, 300000, 400000, 20}
> > };
> >
> > int main(){
> > //unsigned int x1 = 8000000;
> > //unsigned int x2 = 1024;
> > //long long l1 = (long long)x1 * x2;
> > //std::cout << l1 << std::endl;
> > //system("pause");
> > uhd::set_thread_priority_safe();
> >
> > //variables to be set by po
> > std::string args(""), subdev("A:A");
> > size_t num_bins = 1024;
> > float ref_lvl = 0.0, dyn_rng = 100.0;
> >
> > //create a usrp device
> > std::cout << std::endl;
> > std::cout << boost::format("Creating the usrp device with: %s...") %
> > args << std::endl;
> > uhd::usrp::multi_usrp::sptr usrp =
> uhd::usrp::multi_usrp::make(args);
> >
> > //Lock mboard clocks
> > usrp->set_clock_source("internal");
> >
> > //always select the subdevice first, the channel mapping affects the
> > other settings
> > usrp->set_rx_subdev_spec(subdev);
> >
> > std::cout << boost::format("Using Device: %s") %
> usrp->get_pp_string()
> > << std::endl;
> >
> > long freq, bw, rate, gain;
> > for (int i = 0; true; i++)
> > {
> > freq = arryArryAntParam[i%1][0];
> > bw = arryArryAntParam[i%1][1];
> > rate = arryArryAntParam[i%1][2];
> > gain = arryArryAntParam[i%1][3];
> >
> > //std::cout << boost::format("Setting RX Freq: %f MHz...") %
> (freq/1e6)
> > << std::endl;
> > uhd::tune_request_t tune_request(freq);
> > //tune_request.args = uhd::device_addr_t("mode_n=integer");
> > usrp->set_rx_freq(tune_request);
> > //std::cout << boost::format("Actual RX Freq: %f MHz...") %
> > (usrp->get_rx_freq()/1e6) << std::endl << std::endl;
> >
> > //set the analog frontend filter bandwidth
> > //std::cout << boost::format("Setting RX Bandwidth: %f MHz...") %
> > (bw/1e6) << std::endl;
> > usrp->set_rx_bandwidth(bw);
> > //std::cout << boost::format("Actual RX Bandwidth: %f MHz...") %
> > (usrp->get_rx_bandwidth()/1e6) << std::endl << std::endl;
> >
> > //std::cout << boost::format("Setting RX Rate: %f Msps...") %
> (rate/1e6)
> > << std::endl;
> > usrp->set_rx_rate(rate);
> > //std::cout << boost::format("Actual RX Rate: %f Msps...") %
> > (usrp->get_rx_rate()/1e6) << std::endl << std::endl;
> >
> > //set the rf gain
> > //std::cout << boost::format("Setting RX Gain: %f dB...") % gain <<
> > std::endl;
> > usrp->set_rx_gain(gain);
> > //std::cout << boost::format("Actual RX Gain: %f dB...") %
> > usrp->get_rx_gain() << std::endl << std::endl;
> >
> > boost::this_thread::sleep(boost::posix_time::millisec(1));
> //allow for
> > some setup time
> >
> > #if 0
> > //Check Ref and LO Lock detect
> > std::vector<std::string> sensor_names;
> > sensor_names = usrp->get_rx_sensor_names(0);
> > if (std::find(sensor_names.begin(), sensor_names.end(),
> "lo_locked") !=
> > sensor_names.end()) {
> > uhd::sensor_value_t lo_locked = usrp->get_rx_sensor("lo_locked",0);
> > std::cout << boost::format("Checking RX: %s ...") %
> > lo_locked.to_pp_string() << std::endl;
> > UHD_ASSERT_THROW(lo_locked.to_bool());
> > }
> >
> > //create a receive streamer
> > uhd::stream_args_t stream_args("fc32"); //complex floats
> > uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
> >
> > //allocate recv buffer and metatdata
> > uhd::rx_metadata_t md;
> > std::vector<std::complex<float> > buff(num_bins);
> >
> > uhd::stream_cmd_t
> > stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
> > stream_cmd.num_samps = num_bins;
> > stream_cmd.stream_now = true;
> > stream_cmd.time_spec = uhd::time_spec_t();
> > rx_stream->issue_stream_cmd(stream_cmd);
> >
> //rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
> >
> > while (true){
> > //read a buffer's worth of samples every iteration
> > size_t num_rx_samps = rx_stream->recv(
> > &buff.front(), buff.size(), md
> > );
> > if (num_rx_samps != buff.size()) continue;
> >
> > //calculate the dft and create the ascii art frame
> > acsii_art_dft::log_pwr_dft_type lpdft(
> > acsii_art_dft::log_pwr_dft(&buff.front(), num_rx_samps)
> > );
> >
> > //std::string frame = acsii_art_dft::dft_to_plot(
> > //lpdft, 100, 50,
> > //usrp->get_rx_rate(),
> > //usrp->get_rx_freq(),
> > //dyn_rng, ref_lvl
> > //);
> >
> > //printf("%s", frame.c_str());
> > break;
> > }
> >
> >
> rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
> > #endif
> > //boost::this_thread::sleep(boost::posix_time::millisec(1));
> //allow for
> > some setup time
> > }
> >
> > std::cout << std::endl << "Done!" << std::endl << std::endl;
> >
> > return EXIT_SUCCESS;
> > }
> > thank you !
> > John
> >
> >
> > John,
> >
> > it's entirely possible that there's a memory leak in UHD, but in
> order
> > to track that down we'd need some more info on what you're
> doing. Can
> > you maybe even post some code snippets of what you're doing, or give
> > some more description of your code?
> >
> > Cheers,
> > Martin
> >
> > On 21.12.2015 19:30, john liu via USRP-users wrote:
> >> Dear all,
> >> we are using usrp B210 to do spectrum scanning,and
> we take
> >> frequency hopping method to achieve it,and the frequency
> hopping step
> >> is 8M.But every time the frequency change,the memory will be
> up 4K?Can
> >> you give some advice?
> >> Would really appreciate your reply in advance.
> >> Thank you
> >> John
> >>
>
>
>
>
> _______________________________________________
> USRP-users mailing list
> USRP-users@lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
[Attachment #5 (text/html)]
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi John,<br>
we're actively investigating this, but haven't been able to
reproduce your specific rate (or at least the same linear behaviour)
of memory usage growth; we do indeed see an increase of memory usage
over time, but that might as well be libc doing its memory
allocations prefering speed over minimized usage. <br>
As I said, still investigating.<br>
<br>
Best regards,<br>
Marcus<br>
<br>
<div class="moz-cite-prefix">On 01/29/2016 05:02 AM, john liu via
USRP-users wrote:<br>
</div>
<blockquote
cite="mid:CAF6NnTKpKmXUMZ=3EOufXpseLZyaLcbO+b=AxPJ9HCdWgfNfww@mail.gmail.com"
type="cite">
<div dir="ltr">Hi,Martin,
<div> To the question, do you have some conclusions or
suggestions?</div>
<div>Cheers,</div>
<div>John</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Dec 29, 2015 at 10:17 AM,
Martin Braun <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:martin.braun@ettus.com" \
target="_blank">martin.braun@ettus.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks,
John,<br>
<br>
I hope we can find time soon to look into this. Thanks for
sending this!<br>
<br>
Cheers,<br>
Martin<br>
<div class="HOEnZb">
<div class="h5"><br>
On 27.12.2015 17:15, john liu wrote:<br>
> hi,martin,<br>
> I am so sorry to reply you so late.<br>
> and thank you for reply.<br>
> we take frequency hopping in vs2010+windows7,and
we do nothing<br>
> but frequency hopping.<br>
> here is our test code:<br>
><br>
> namespace po = boost::program_options;<br>
><br>
> long arryArryAntParam[][4] = {<br>
> {101700000, 8000000, 16000000, 20},<br>
> //{102600000, 300000, 400000, 20}<br>
> };<br>
><br>
> int main(){<br>
> //unsigned int x1 = 8000000;<br>
> //unsigned int x2 = 1024;<br>
> //long long l1 = (long long)x1 * x2;<br>
> //std::cout << l1 << std::endl;<br>
> //system("pause");<br>
> uhd::set_thread_priority_safe();<br>
><br>
> //variables to be set by po<br>
> std::string args(""), subdev("A:A");<br>
> size_t num_bins = 1024;<br>
> float ref_lvl = 0.0, dyn_rng = 100.0;<br>
><br>
> //create a usrp device<br>
> std::cout << std::endl;<br>
> std::cout << boost::format("Creating the usrp
device with: %s...") %<br>
> args << std::endl;<br>
> uhd::usrp::multi_usrp::sptr usrp =
uhd::usrp::multi_usrp::make(args);<br>
><br>
> //Lock mboard clocks<br>
> usrp->set_clock_source("internal");<br>
><br>
> //always select the subdevice first, the channel
mapping affects the<br>
> other settings<br>
> usrp->set_rx_subdev_spec(subdev);<br>
><br>
> std::cout << boost::format("Using Device:
%s") % usrp->get_pp_string()<br>
> << std::endl;<br>
><br>
> long freq, bw, rate, gain;<br>
> for (int i = 0; true; i++)<br>
> {<br>
> freq = arryArryAntParam[i%1][0];<br>
> bw = arryArryAntParam[i%1][1];<br>
> rate = arryArryAntParam[i%1][2];<br>
> gain = arryArryAntParam[i%1][3];<br>
><br>
> //std::cout << boost::format("Setting RX
Freq: %f MHz...") % (freq/1e6)<br>
> << std::endl;<br>
> uhd::tune_request_t tune_request(freq);<br>
> //tune_request.args =
uhd::device_addr_t("mode_n=integer");<br>
> usrp->set_rx_freq(tune_request);<br>
> //std::cout << boost::format("Actual RX Freq:
%f MHz...") %<br>
> (usrp->get_rx_freq()/1e6) << std::endl
<< std::endl;<br>
><br>
> //set the analog frontend filter bandwidth<br>
> //std::cout << boost::format("Setting RX
Bandwidth: %f MHz...") %<br>
> (bw/1e6) << std::endl;<br>
> usrp->set_rx_bandwidth(bw);<br>
> //std::cout << boost::format("Actual RX
Bandwidth: %f MHz...") %<br>
> (usrp->get_rx_bandwidth()/1e6) <<
std::endl << std::endl;<br>
><br>
> //std::cout << boost::format("Setting RX
Rate: %f Msps...") % (rate/1e6)<br>
> << std::endl;<br>
> usrp->set_rx_rate(rate);<br>
> //std::cout << boost::format("Actual RX Rate:
%f Msps...") %<br>
> (usrp->get_rx_rate()/1e6) << std::endl
<< std::endl;<br>
><br>
> //set the rf gain<br>
> //std::cout << boost::format("Setting RX
Gain: %f dB...") % gain <<<br>
> std::endl;<br>
> usrp->set_rx_gain(gain);<br>
> //std::cout << boost::format("Actual RX Gain:
%f dB...") %<br>
> usrp->get_rx_gain() << std::endl <<
std::endl;<br>
><br>
>
boost::this_thread::sleep(boost::posix_time::millisec(1));
//allow for<br>
> some setup time<br>
><br>
> #if 0<br>
> //Check Ref and LO Lock detect<br>
> std::vector<std::string> sensor_names;<br>
> sensor_names = usrp->get_rx_sensor_names(0);<br>
> if (std::find(sensor_names.begin(),
sensor_names.end(), "lo_locked") !=<br>
> sensor_names.end()) {<br>
> uhd::sensor_value_t lo_locked =
usrp->get_rx_sensor("lo_locked",0);<br>
> std::cout << boost::format("Checking RX: %s
...") %<br>
> lo_locked.to_pp_string() << std::endl;<br>
> UHD_ASSERT_THROW(lo_locked.to_bool());<br>
> }<br>
><br>
> //create a receive streamer<br>
> uhd::stream_args_t stream_args("fc32"); //complex
floats<br>
> uhd::rx_streamer::sptr rx_stream =
usrp->get_rx_stream(stream_args);<br>
><br>
> //allocate recv buffer and metatdata<br>
> uhd::rx_metadata_t md;<br>
> std::vector<std::complex<float> >
buff(num_bins);<br>
><br>
> uhd::stream_cmd_t<br>
>
stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);<br>
> stream_cmd.num_samps = num_bins;<br>
> stream_cmd.stream_now = true;<br>
> stream_cmd.time_spec = uhd::time_spec_t();<br>
> rx_stream->issue_stream_cmd(stream_cmd);<br>
>
//rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);<br>
><br>
> while (true){<br>
> //read a buffer's worth of samples every iteration<br>
> size_t num_rx_samps = rx_stream->recv(<br>
> &buff.front(), buff.size(), md<br>
> );<br>
> if (num_rx_samps != buff.size()) continue;<br>
><br>
> //calculate the dft and create the ascii art frame<br>
> acsii_art_dft::log_pwr_dft_type lpdft(<br>
> acsii_art_dft::log_pwr_dft(&buff.front(),
num_rx_samps)<br>
> );<br>
><br>
> //std::string frame = acsii_art_dft::dft_to_plot(<br>
> //lpdft, 100, 50,<br>
> //usrp->get_rx_rate(),<br>
> //usrp->get_rx_freq(),<br>
> //dyn_rng, ref_lvl<br>
> //);<br>
><br>
> //printf("%s", frame.c_str());<br>
> break;<br>
> }<br>
><br>
>
rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);<br>
> #endif<br>
>
//boost::this_thread::sleep(boost::posix_time::millisec(1));
//allow for<br>
> some setup time<br>
> }<br>
><br>
> std::cout << std::endl << "Done!"
<< std::endl << std::endl;<br>
><br>
> return EXIT_SUCCESS;<br>
> }<br>
> thank you !<br>
> John<br>
><br>
><br>
> John,<br>
><br>
> it's entirely possible that there's a memory leak
in UHD, but in order<br>
> to track that down we'd need some more info on what
you're doing. Can<br>
> you maybe even post some code snippets of what
you're doing, or give<br>
> some more description of your code?<br>
><br>
> Cheers,<br>
> Martin<br>
><br>
> On 21.12.2015 19:30, john liu via USRP-users wrote:<br>
>> Dear all,<br>
>> we are using usrp B210 to do
spectrum scanning,and we take<br>
>> frequency hopping method to achieve it,and the
frequency hopping step<br>
>> is 8M.But every time the frequency change,the
memory will be up 4K?Can<br>
>> you give some advice?<br>
>> Would really appreciate your reply in advance.<br>
>> Thank you<br>
>> John<br>
>><br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
USRP-users mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:USRP-users@lists.ettus.com">USRP-users@lists.ettus.com</a> <a \
class="moz-txt-link-freetext" \
href="http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com">http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com</a>
</pre>
</blockquote>
<br>
</body>
</html>
_______________________________________________
USRP-users mailing list
USRP-users@lists.ettus.com
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic