From 39d5d74d6adb5470fd7f4f22349d9fa90661682d Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 21 Apr 2026 15:03:57 -0400 Subject: [PATCH] large memory fix --- src/ria_toolkit_oss/orchestration/tx_executor.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ria_toolkit_oss/orchestration/tx_executor.py b/src/ria_toolkit_oss/orchestration/tx_executor.py index 84e200b..2d9e1c1 100644 --- a/src/ria_toolkit_oss/orchestration/tx_executor.py +++ b/src/ria_toolkit_oss/orchestration/tx_executor.py @@ -70,6 +70,12 @@ _MOD_TABLE: dict[str, tuple[int, str]] = { _SPECIAL_MODS = {"FSK", "OOK", "GMSK", "OQPSK"} +# usrp-uhd-client's tx_recording() streams 2 000-sample chunks and loops the +# source buffer for the full tx_time, so only this many samples ever need to +# be in RAM regardless of step duration or sample rate. +# 50 000 complex64 samples ≈ 400 kB — enough spectral diversity for looping. +_SYNTH_BLOCK_SAMPLES = 50_000 + class TxExecutor: """Synthesise and transmit a signal campaign via a local SDR. @@ -145,7 +151,12 @@ class TxExecutor: ) num_samples = int(duration * sample_rate) - signal = self._synthesise(modulation, sps, num_samples, filter_type, rolloff) + + # Synthesise a short representative block. tx_recording() loops this + # buffer for the full tx_time using a 2 000-sample streaming callback, + # so peak memory is O(_SYNTH_BLOCK_SAMPLES) regardless of duration. + block_size = min(num_samples, _SYNTH_BLOCK_SAMPLES) + signal = self._synthesise(modulation, sps, block_size, filter_type, rolloff) if self._sdr is not None: try: