Closed zoekatakuzinos closed 5 months ago
I have made it work. I did not start a new thread from the ToImage function (which was called from OnFrameReceived) I rather put the code directly into ToImage function and the memory seems stable now. It was perhaps not a good design to start a new thread from within an async function
I am also wondering about this memory leak issue. I am using the decoding github project "rtspcapture - working" which gives me the SnapshotMaker example. I changed it to a Winforms project so I could stream to a picture box, and then take a snapshot, and put it in another picture box.
I commented out the ToImage() function so I took out all displaying of Images in my picture boxes. The memory seems more stable.
When calling the ToImage function, my memory spikes up when taking shapshots, even though I am clearing my Picture Boxes. As I take more snapshots, the memory climbs higher.
It never come down, even when calling the GC explicitly. I am not sure how to clean up ? Can you help?
(This code comes from my crude test program)
Originally posted by @zoekatakuzinos in https://github.com/BogdanovKirill/RtspClientSharp/issues/40#issuecomment-1914546992