Strange memory usage

I have an 800 page (8.1MB -- NOT GB) PDF.

If I scroll through the document using the scroll bar or the pg dn button, Visual Studio shows the app is using maybe 1.5 gb physical memory. And it remains steady, never rising, all the way through the end of the document.

But if I page through it using the toolbar page next button, the memory usage steadily rises until it hits 9GB (not MB) by the end of the document.

Why does the toolbar navigation take up so much more memory than regular scrolling?


7 Replies

KG Krithika Ganesan Syncfusion Team March 14, 2024 04:37 PM UTC

Hi Keith,

 

We have tried to reproduce the reported issue with the 13 MB PDF document, to reproduce the issue, but we are unable to reproduce the reported issue. We are suspecting that it may be due to document specific, can you please share the document you are facing this issue?

 

We have an NDA (Non-Disclosure Agreement) in place with our customers and we maintain the confidentiality of the information disclosed by our customers to us. Therefore, any documents shared with Syncfusion will only be used to replicate the issue and will not be shared with anyone else. So kindly share the original input document or share the input document after removing confidential information.

 

Regards,

Krithika



KA Keith A Price March 14, 2024 05:41 PM UTC

Here is the file with confidential data obscured. I also recorded the Visual Studio diagnostic window while scrolling with the pgdn and again with the toolbar pgnext. They're both in a RAR file. Hope that helps.


Attachment: PdfViewer_Memory_Usage_798c4cc0.rar


KG Krithika Ganesan Syncfusion Team March 15, 2024 01:34 PM UTC

Hi Keith,

 

We were able to reproduce the issue on our end and will update you with the analyzed details on March 19th. We appreciate your patience until then.

 

Regards,

Krithika



KG Krithika Ganesan Syncfusion Team March 19, 2024 03:11 PM UTC

When navigating through a larger number of pages using the scroll bar in PdfViewer, memory consumption will be lower because PdfViewer does not render in-between pages. However, memory consumption will be similar when navigating pages using the mouse scroll and the next page button click. Even though, We will investigate this memory consumption further and provide additional details on March 21, 2024.



KA Keith A Price March 19, 2024 06:35 PM UTC

A slight difference makes sense. But this was a 10x increase in memory usage. Something's not right. Looking forward to your findings.



KG Krithika Ganesan Syncfusion Team March 20, 2024 02:44 PM UTC

In the WPF PdfViewer using the Virtualization concept as we will render 3 pages at a time (current page, previous page, and next page), while using scroll bar when it stops scrolling , we render only 3 pages from the current page. However, when using the Next page button click, we render the current page, previous page, and next page for every click.  Hence there is Difference. As mentioned earlier, we will investigate this memory consumption is valid or not , and provide additional details on March 21, 2024.



RB Rajavignesh BalaSankar Syncfusion Team March 21, 2024 04:00 PM UTC

In WPF PdfViewer, we render the pdf files by creating the pdf pages as images using the Pdfium. In framework, the memory of the images can’t be cleared completely even after forced clear the memory. So, it will consume some memory for the image creation process. We have also confirmed this by reporting the issue in the MSDN WPF forum earlier for the similar issue.

https://github.com/dotnet/wpf/issues/1082#issuecomment-608326285

Also, we found that the process memory is alone increased constantly as it consumes the memory for the entire project including debugging. But the Snapshot memory which is seen while taking snapshots in the memory usage tab, shows the memory consumed by the code used in the project. So, the process memory will usually be high that the snapshot memory. You can also refer the below MSDN forum for more details,

https://social.msdn.microsoft.com/Forums/en-US/fb5517b3-e1f4-4fc2-be0f-1872ce41f5c3/snapshot-memory-vs-process-memory?forum=vsdebug


Loader.
Up arrow icon