ubuntu 16.04
GNU radio 3.7.12
UHD 3.10.1.1
Numpy 1.13.1
Scipy 0.19.1
I met this problem when I use Gnuradio to genarate a dataset,These codes used to work well until I change another computer,I search this problem and find that someone think it's a problem of Numpy,but I'm not surely understand .
If anybody has any idea how I could debug this or what could possibly be the cause of this; all tips are welcome!
Here is the error report:
StackTrace:
double free or corruption (out): 0x0000000001e4b030
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7ffa89d707e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7ffa89d7937a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7ffa89d7d53c]
/usr/local/lib/libgnuradio-runtime-3.7.12git.so.0.0.0(_ZN2gr5blockD1Ev+0x77)[0x7ffa882768e7]
/usr/local/lib/libgnuradio-mediatools.so(+0xd065)[0x7ffa6940b065]
/usr/local/lib/python2.7/dist-packages/mediatools/_mediatools_swig.so(+0xbd2a)[0x7ffa6962bd2a]
/usr/local/lib/python2.7/dist-packages/mediatools/_mediatools_swig.so(+0xfe60)[0x7ffa6962fe60]
python(PyObject_Call+0x43)[0x4b0cb3]
python(PyObject_CallFunctionObjArgs+0x16a)[0x4b97fa]
/usr/local/lib/python2.7/dist-packages/mediatools
/_mediatools_swig.so(+0x12640)[0x7ffa69632640]
python[0x4fd4e6]
python[0x4fd4e6]
python(PyDict_SetItem+0x442)[0x4a0d22]
python(_PyModule_Clear+0x133)[0x502bf3]
python(PyImport_Cleanup+0x1ac)[0x50275c]
python(Py_Finalize+0x89)[0x500489]
python(Py_Main+0x46f)[0x49df2f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7ffa89d19830]
python(_start+0x29)[0x49d9d9]
======= Memory map: ========
and Here is the code:
#!/usr/bin/env python
from gnuradio import gr, blocks
import mediatools
import numpy as np
class source_alphabet(gr.hier_block2):
def __init__(self, dtype="discrete", limit=10000, randomize=False):
if(dtype == "discrete"):
gr.hier_block2.__init__(self, "source_alphabet",
gr.io_signature(0,0,0),
gr.io_signature(1,1,gr.sizeof_char))
self.src = blocks.file_source(gr.sizeof_char, "source_material/gutenberg_shakespeare.txt")
self.convert = blocks.packed_to_unpacked_bb(1, gr.GR_LSB_FIRST);
#self.convert = blocks.packed_to_unpacked_bb(8, gr.GR_LSB_FIRST);
self.limit = blocks.head(gr.sizeof_char, limit)
self.connect(self.src,self.convert)
last = self.convert
# whiten our sequence with a random block scrambler (optionally)
if(randomize):
rand_len = 256
rand_bits = np.random.randint(2, size=rand_len)
self.randsrc = blocks.vector_source_b(rand_bits, True)
self.xor = blocks.xor_bb()
self.connect(self.randsrc,(self.xor,1))
self.connect(last, self.xor)
last = self.xor
else: # "type_continuous"
gr.hier_block2.__init__(self, "source_alphabet",
gr.io_signature(0,0,0),
gr.io_signature(1,1,gr.sizeof_float))
self.src = mediatools.audiosource_s(["source_material/serial-s01-e01.mp3"])
self.convert2 = blocks.interleaved_short_to_complex()
self.convert3 = blocks.multiply_const_cc(1.0/65535)
self.convert = blocks.complex_to_float()
self.limit = blocks.head(gr.sizeof_float, limit)
# print(self.limit)
self.connect(self.src,self.convert2,self.convert3, self.convert)
last = self.convert
# connect head or not, and connect to output
if(limit==None):
self.connect(last, self)
else:
self.connect(last, self.limit, self)
if __name__ == "__main__":
print "QA..."
# Test discrete source
tb = gr.top_block()
src = source_alphabet("discrete", 1000)
snk = blocks.vector_sink_b()
tb.run()
# Test continuous source
tb = gr.top_block()
src = source_alphabet("continuous", 1000)
snk = blocks.vector_sink_f()
tb.run()