When I print a large PDF with hundreds of pages, the RAM will be filled like crazy. For a ~300 pages PDF I get like 20GB RAM usage.
The memory usage here for a smaller PDF file, but which still uses pretty much RAM:
Memory doesn't get freed completely after Printing and Unloading:
Simplified version of the code which I am using:
PdfDocumentView document = new();
document.Load(stream);document.Print(etiketteSetting.SelectedPrinter);
// Unload the Syncfusion print component (or else memory leaks will occur)// The acual unload will occur when the next document gets loaded.
// So the memory will stay on the same level as long as nothing is printed after a big print job.document.Unload(disposeDocument: true);How can I disable this memory hogging? I don't want to print the same PDF a second time. A PDF gets only printed once in my app, so I don't need any caching or other stuff. I want everything to be disposed after the Print().
I upload here a test with a 200 page PDF as well, to deliver real life results:
I already use version 19.2.0.44 of the NuGet package, so this issue is not yet resolved.
This is from my .csproj file:
Hi Sathish,
Thank you for investigating. It is correct that your sample (and the one I posted in the first post) won't get this issue. I attached a stripped down version of my code with an extreme example (495 PDF pages) where you should see the issue I'm facing.
It has to do something with the configuration I think, but I can't spot what exactly triggers this memory behaviour.
My app is a .NET 5 WPF app, so you need VS 2019 to open it.
The crazy memory usage in the example I posted:
|
Code snippet :
GC.Collect();
GC.WaitForPendingFinalizers(); |