Completed
Last Updated: 30 May 2022 11:34 by ADMIN
Release LIB 2022.2.606 (06 June 2022)
Eric
Created on: 21 Jan 2022 19:16
Category: WebCam
Type: Bug Report
1
RadWebCam causes a major memory leak when CameraSettingsControl is used

I have a WPF window containing a RadWebCam control and a CameraSettingsControl control associated with it (as shown in the online documentation). When I close the WPF window, no memory associated with that window is released. I implemented a Finalizer in the window and found that it wasn't getting called even after several GC.Collect() calls.  The culprit appears to be the CameraSettingsControl when it's associated with the RadWebCam control. In my application, it's not freeing about 80MB of memory after each window invocation.

I have included a full project sample which demonstrates the issue. Just set a BreakPoint on the finalizer ~TakePicture(). When the application is run, hit the 'Take Picture' button to launch the Camera window, and then close it.  To verify that it's not just a delay in garbage collection, hit the GCCollect button on the main window a couple of times. The Finalizer never gets called until you exit the app.

Here's the Telerik control WPF I'm using, but it's also in the sample.

<telerikWebCam:RadWebCam Grid.Column ="0" x:Uid="WebCamCaptureWindow_RadWebCam" x:Name="webCam" MinWidth="0" MinHeight="0" AutoStart="False" Margin="0 25 0, 0" 

                                       BorderThickness="0"
                                       Background="Black"
                                       PreviewSnapshots="True"
                                       RecordingButtonVisibility="Collapsed"
                                       Visibility="Visible"
                                       CameraError="OnWebCamCameraError" />

<telerikWebCam:CameraSettingsControl Grid.Column ="1" x:Uid="WebCamCaptureWindow_CameraControlSettings" x:Name="webCamSettingsControl" WebCam="{Binding ElementName=webCam}" 
                                                         Visibility="Visible"/>
Attached Files:
2 comments
ADMIN
Petar Mladenov
Posted on: 27 May 2022 10:31

Hi Eric,

The fix for this item will be under testing next week and eventually it will be live with the internal build from week starting at June 6th.
Just posting a possible workaround here if anyone hits this meanwhile:

Subscribe to Window Closing/Closed event and manually call the Dispose method of RadWebCam:

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            this.webCam.Dispose();
        }

Regards,
Petar Mladenov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

ADMIN
Dilyan Traykov
Posted on: 24 Jan 2022 11:24

Hello Eric,

Thank you very much for the provided sample project.

I can confirm that I was also able to replicate the memory leak at my end and have thus converted this ticket to a bug report. I've also awarded you some Telerik points for bringing this to our attention.

We will try to address this issue as soon as possible. You will get notified once the status of this item changes.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.