discuss-gnuradio
[Top][All Lists]
Advanced

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

GNURadio Leaking memory during repeated simulations


From: Roman A Sandler
Subject: GNURadio Leaking memory during repeated simulations
Date: Tue, 11 Feb 2020 16:34:10 -0800

Hi,

I am using GNURadio to decode a large amount of 1024-sample complex vectors of different modulation schemes. Thus, I have a for loop which runs gr.top_block.run() at each iteration and uses a vector sink to collect the results. The issue is that as the simulation keeps going, each itertion takes longer (e.g. starts of at 120it/sec, and then after 5000 iterations slows down to 10it/sec). I can see in task manager (I am on windows) that memory is increasing so clearly there is a memory leak where somehow the results of the iterations arent being deleted.

Is there an explicit way to delete runs or is this a bug?

CODE:

calling code:
```
for _ in range(10000):
    decode(sig)
```

decode func:
```
def decode(channel_sigs):
    tb = gr.top_block()

    ##################################################
    # Variables
    ##################################################
    nfilts = 32
    sps = 4
    timing_loop_bw = 3 * 6.28 / 100.0  # NOTE: this controls convergence speed!
    constellation_scheme, bps = get_constellation_scheme(scheme)
    rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0 / float(sps), 0.35, 11 * sps * nfilts)
    phase_bw = 6.28 / 100.0
    eq_gain = 0.01
    arity = 4

    #### Actual blocks
    channel_src = blocks.vector_source_c(channel_sigs, False)
    digital_pfb_clock_sync = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, rrc_taps, nfilts,
                                                        nfilts / 2, 1.5, 1)
    constellation_soft_decoder = digital.constellation_soft_decoder_cf(constellation_scheme)
    binary_slicer = digital.binary_slicer_fb()
    blocks_char_to_float = blocks.char_to_float(1, 1)
    recovered_bits_dst = blocks.vector_sink_f()

    ##################################################
    # Connections
    ##################################################
    tb.connect((channel_src, 0), (digital_pfb_clock_sync, 0))
    tb.connect((digital_pfb_clock_sync, 0), (constellation_soft_decoder, 0))
    tb.connect((constellation_soft_decoder, 0), (binary_slicer, 0))
    tb.connect((binary_slicer, 0), (blocks_char_to_float, 0))
    tb.connect((blocks_char_to_float, 0), (recovered_bits_dst, 0))

    tb.run()

    recovered_bits = np.array(recovered_bits_dst.data())
    return recovered_bits
```

reply via email to

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