diff --git a/main.py b/main.py index 9460de5..cbb527b 100644 --- a/main.py +++ b/main.py @@ -845,6 +845,7 @@ def main() -> int: try: import gc gc.disable() + gc.collect() # One final sweep to clear boot-time cyclic garbage logger.info("GC disabled for RT audio stability") except Exception as exc: logger.warning("Could not disable GC: %s", exc) diff --git a/src/web/server.py b/src/web/server.py index 7c22da2..6765236 100644 --- a/src/web/server.py +++ b/src/web/server.py @@ -487,9 +487,16 @@ class WebServer: """Full pedal state snapshot. Without parameters returns the active (guitar) channel's flat state. - ``?channel=guitar|bass`` returns per-channel state. - ``?combined=true`` returns both channel states in a combined view. + ?channel=guitar|bass returns per-channel state. + ?combined=true returns both channel states in a combined view. """ + # Periodic GC collection — GC is disabled for RT audio stability, + # so collect cyclics here on the HTTP thread every state poll (~2s) + try: + import gc + gc.collect() + except Exception: + pass if combined: state = self._gather_state_combined() else: