ref:1d9ab7b8d8bb623a9f4608b4ddc5c252e3c9e1c9

fix(linux): avoid memory leak from unnecessary encoder re-probing (#5404)

SHA: 1d9ab7b8d8bb623a9f4608b4ddc5c252e3c9e1c9
Author: neatnoise <neatnoise@gmail.com>
Date: 2026-07-12 22:32
Parents: c78b982
1 files changed +9 -1
Type
src/platform/linux/misc.cpp +9 −1
@@ -1247,6 +1247,14 @@
* @return Always `true` because Linux GPU changes are not tracked by this backend.
*/
bool needs_encoder_reenumeration() {
// We don't track GPU state, so we will always reenumerate. Fortunately, it is fast on Linux.
// Only re-probe if the GPU render device changed (hotplug, driver reload).
// Full re-probing on every reconnect leaks ~20 MB due to FFmpeg CBS
// allocations during HEVC/AV1 codec validation.
static std::string last_render_device;
auto current = platf::resolve_render_device();
if (current == last_render_device) {
return false;
}
last_render_device = current;
return true;
}