mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-10 03:21:30 -10:00
The six buffers the mic read pipeline flushes through - input, converted, dual-mono, resampled, resampled-mono and final - were allocated at driver init, which with microphone support enabled by default meant 960 kilobytes of aligned heap on every session, 30 times max_frames across the six, paid whether or not any core ever opened a microphone; a massif census of a headless run found them sitting at peak. They now allocate on the first mic open, verified idempotent against reopen and freed and nulled by the existing deinit so a later open reallocates; the read path is only reachable through an opened mic, so no consumer can see them null. A second massif run confirms the startup attribution gone. The driver context itself still initializes at startup and is the remaining deferral candidate, left for a separate change.