[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] Virtual memory problem assumably caused by threaded p
From: |
Christian Sokolowski |
Subject: |
[Discuss-gnuradio] Virtual memory problem assumably caused by threaded process |
Date: |
Fri, 10 Aug 2007 19:41:04 +0200 |
User-agent: |
KMail/1.9.5 |
Hi all,
the receiver of a point-to-point communication system is causing some memory
trouble.
rx_graph() architecture:
usrp.board - some signal processing blocks - packet sink
Arriving packets are fed to a message_queue. A thread watches this
queue and arriving packets are proceeded to main().
Pseudo-code of the receiver:
class rx_graph (gr.flow_graph):
def __init__(self, callback):
gr.flow_graph.__init__(self)
self.dst_queue = gr.msg_queue(1)
self._watcher = _queue_watcher_thread (self.dst_queue, callback)
def configure(self, _k, _RXfreq):
'all signal processing blocks are connect here...'
class _queue_watcher_thread(_threading.Thread):
def __init__(self, rcvd_pktq, callback):
_threading.Thread.__init__(self)
self.setDaemon(1)
self.rcvd_pktq = rcvd_pktq
self.callback = callback
self.keep_running = True
self.start()
def run(self):
while self.keep_running:
msg = self.rcvd_pktq.delete_head()
payload = msg.to_string()
if self.callback:
self.callback(payload, bits_correct, bits_wrong)
main():
def callback(payload, bits_correct, bits_wrong):
"payload is processed here"
while True:
# a new object of rx_graph is created after every 100 transmitted
# packets in order to perform rate adaptation
rx = rx_graph(callback) # creates an object of rx_graph
# receiving modulation and carrier frequency via TCP socket"
# modulation order and carrier frequency have been separately
# transmitted with TCP before starting to receive payload packets
rx.configure( modulation_order, RXfreq )
rx.start()
...now receiving packets...
rx.stop()
rx = 0 # <------------ works somehow, but this does not free the
# memory and stop the thread!?
The application works as I wish, but some memory is not freed properly.
For some unknown reason virtual memory usage is continously increasing and
the python application crashes after exceeding 1.6GB with the following
error message:
File "./GA_receiver_ver7.py", line 237, in <module>
main()
File "./GA_receiver_ver7.py", line 192, in main
rx.start()
File "/usr/local/lib/python2.5/site-packages/gnuradio/gr/flow_graph.py",
line 93, in start
self.scheduler.start ()
File "/usr/local/lib/python2.5/site-packages/gnuradio/gr/scheduler.py",
line 57, in start
thread.start()
File "/usr/lib/python2.5/threading.py", line 434, in start
_start_new_thread(self.__bootstrap, ())
thread.error: can't start new thread
Exception exceptions.AssertionError: AssertionError('cannot join thread
before it is started',) in <bound method rx_graph.__del__ of
<__main__.rx_graph object at 0x82903ec>> ignored
I wonder if the _queue_watcher_thread is closed each time at the end of the
while loop in main properly when I set the object rx=0. Do I need to
consider some memory deallocation issues?
I greatly appreciate any kind of help.
The full receiver script can be seen here:
http://www.mobnets.rwth-aachen.de/~ade/cso/GA_receiver_ver7.py
Thanks, Chris
---------------------------------------------------------------------
Christian Sokolowski Office: +49(0)-240-7575-7043
RWTH Aachen FAX: +49(0)-240-7575-7050
Wireless Networks Dept
Kackertstrasse 9 E-mail: address@hidden
D-52072 Aachen Web: http://www.mobnets.rwth-aachen.de
---------------------------------------------------------------------
-------------------------------------------------------
- [Discuss-gnuradio] Virtual memory problem assumably caused by threaded process,
Christian Sokolowski <=