Last Updated: 28 Apr 2022 07:25 by ADMIN
Created on: 21 Apr 2022 07:48
Category: PDFViewer
Type: Bug Report
PdfViewer: Reflection used in ContentElementsCanvas creates Dispatchers that are never released
When displaying PDF-Files using PDFViewer, ContentElementsCanvas .RenderAsync uses reflection (DispatcherObjectUtils.ApplyDispatcher) to render Visuals on multiple threads.
However this leads to a memory leak since the dispatchers cant be GC'ed, see screenshot below.

The Screenshot is from the actual application we expirienced this issue with, the attached reproduction example is a boiled down version of what your code does.
If you wanna reproduce this on your own, create an application that uses PdfViewer that switches between many pdf files. The ammount of Dispatchers will grow steadily, probably to a total of the number of threads used by Task.Factory.

Attached Files:
Posted on: 28 Apr 2022 07:25

Hello Christian,

Thank you for that information. I have tested both - the isolated logic and PdfViewer. The behavior seems like an issue in the WPF framework and we will need some additional time to further investigate the case and the possibilities we have for fixing it. I am approving the report and we will update the item once we have any information on it.

Your Telerik points are updated in appreciation of bringing this behavior to our attention.

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/.

Posted on: 21 Apr 2022 09:27
The Dispatchers themself are not so bad but the objects that are attached to the MediaConext.