Bug
SoundDeviceBackend pre-allocates the output numpy view once (sounddevice_backend.py:267, _out_np), but the input path calls self._input_tensor.numpy() inside the PortAudio callback on every invocation (line ~295). .numpy() on a CPU tensor creates a view, but it still constructs a new ndarray object per callback (Python allocation + refcount churn on the RT thread), which is exactly what the pre-allocated output view exists to avoid.
Fix
Pre-allocate _in_np = self._input_tensor.numpy() next to _out_np and reuse it in the callback. Keeps the callback allocation-free, consistent with the latency-tail claims in the realtime instrumentation.
Bug
SoundDeviceBackendpre-allocates the output numpy view once (sounddevice_backend.py:267,_out_np), but the input path callsself._input_tensor.numpy()inside the PortAudio callback on every invocation (line ~295)..numpy()on a CPU tensor creates a view, but it still constructs a new ndarray object per callback (Python allocation + refcount churn on the RT thread), which is exactly what the pre-allocated output view exists to avoid.Fix
Pre-allocate
_in_np = self._input_tensor.numpy()next to_out_npand reuse it in the callback. Keeps the callback allocation-free, consistent with the latency-tail claims in the realtime instrumentation.