discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] memory leak when creating several usrp2 objects


From: Jakob Meineke
Subject: [Discuss-gnuradio] memory leak when creating several usrp2 objects
Date: Thu, 30 Jul 2009 18:40:00 +0200

Hi all,

I have encountered a memory leak that seems to be related to the creation of
a usrp2_sink object. An admittedly stupid test case that shows the same
symptoms as my actual program is given below:

import time
from gnuradio import gr
from gnuradio import usrp2

if __name__ == "__main__":
  for i in range(5):
    time.sleep(2)
    usrp2.sink_16sc("eth0", "")

I can then see that every two seconds the program takes up another ca. 24 MB
of RAM as seen with htop. This is with rev 11516 on ubuntu 8.10.
In the test case the problem goes away if one assigns the return value of
usrp2.sink_16sc as one would do of course to do anything sensible with a
usrp2.
In my actual program I run a twisted reactor as a main loop and repeatedly
create a usrp2 sink in a function I have attached as a callback to a
deferred. The sink is part of a flow graph that transmits the content of a
file created prior to execution. I then observe the same increase in the
used memory as in the above test case, which eventually leads to the program
being killed. I have tried to delete the usrp2 object after use but without
success. The memory leak does not occur if I comment out the creation of the
usrp2 sink.
I would very much appreciate your input on how to solve this problem. If
there was for example a good way to reuse the same usrp2_sink object I would
happily use it. How does gnuradio handle the case that several objects
talking to the same usrp2 are created? It seemed to me that it is aware of
how many instance are created.
Thank you very much in advance. Cheers,

Jakob





reply via email to

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