b02e4b109b
This change fixes a memory leak in the mac-virtualcam plugin that causes OBS to not release the CVPixelBuffers (and underlying IOSurfaces) it emits to the virtual camera consumers. Pull request https://github.com/obsproject/obs-studio/pull/6573 (Avoid transcoding where possible) updated the mac-virtualcam to share the virtual camera feed with other processes via IOSurfaces. Although the changes work correctly, users have observed that OBS memory usage keeps increasing when the virtual camera is active until OBS runs out of memory or the consuming application is closed. See the report by @SciTechNick for more information: https://github.com/obsproject/obs-studio/pull/6573#issuecomment-1161979765 After some debugging, I have found that the plugin is leaking Mach ports associated with IOSurfaces, preventing them from being re-used. The previous approach using `NSMachPort` does not seem to properly release the Mach port allocated via `CVPixelBufferGetIOSurface` and `IOSurfaceLookupFromMachPort`. Instead, we must explicitly deallocate the port using `mach_port_deallocate`. I have tested the changes on a Macbook Pro (M1) running macOS Monterey with Google Chrome, Zoom, and Cameo. OBS shows no signs of memory leakage after multiple minutes. |
||
---|---|---|
.. | ||
data/locale | ||
src | ||
CMakeLists.txt |