Skip to content

Commit

Permalink
catch memory error for network sdr buffer allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jopohl committed May 12, 2017
1 parent fafe165 commit 15169f8
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def __init__(self, raw_mode=False, resume_on_full_receive_buffer=False, spectrum
if self.raw_mode:
num_samples = SettingsProxy.get_receive_buffer_size(self.resume_on_full_receive_buffer,
self.is_in_spectrum_mode)
self.receive_buffer = np.zeros(int(num_samples), dtype=np.complex64, order='C')
try:
self.receive_buffer = np.zeros(num_samples, dtype=np.complex64, order='C')
except MemoryError:
logger.warning("Could not allocate buffer with {0:d} samples, trying less...")
self.receive_buffer = np.zeros(num_samples // 2, dtype=np.complex64, order='C')
else:
self.received_bits = []

Expand Down

0 comments on commit 15169f8

Please sign in to comment.