MediaFrameReader Memory Leak?

Ben Eberly 1 Reputation point
2022-09-29T20:26:28.063+00:00

I'm following the guide linked below very closely, and have tried all sorts of usings and disposes, but I can't seem to stop massive GC pressure from occurring as soon as I run .CreateFrameReaderAsync() — even if I don't set any handlers for the FrameArrived event or call .TryAcquireLatestFrame(). The GC is running constantly and if it doesn't, memory consumption is at several GBs in seconds. Is there something I am missing? Or is there something wrong with the MediaFrameReader class?

https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/process-media-frames-with-mediaframereader

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,812 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,709 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,208 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.