In the program, the camera should display everything that happens online without recording information, for this I use the AForge.Video and AForge.Video.DirectShow libraries from Aforge.net. When viewing the task manager, I noticed that when the camera is turned on, the application starts to have memory until a certain moment (as I understand, images from the stream are accumulated), then the memory is reset, apparently by the CLR, then again everything is new. And now the question: how to clean up the accumulated information from the stream independently without the help of the CLR? Code example:
private FilterInfoCollection videoDevices = null; private VideoCaptureDevice videoSource = null; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString); videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame); videoSource.Start(); } void videoSource_NewFrame(object sender, NewFrameEventArgs eventArgs) { this.pictureBox1.Image = (Image)eventArgs.Frame.Clone(); }