Groupdocs.Viewer OutOfMemoryException when converting JPG to PDF

Hello, I use GroupDocs.Viewer version 23.1.0 and have noticed an issue with image conversion, such as JPG to PDF. Specifically, the problem lies with objects that end up on the Large Object Heap (LOH) and are not being released, leading to eventual OutOfMemoryException. Have you observed similar issues, and are there any known solutions to prevent this? From my observations, I haven’t noticed this happening with other conversions, like Docx to Pdf.

after converting about 15 jpg images og 1MB each.
image.png (27,6 KB)
image.png (11,7 KB)

@devFordata

Thank you for posting this issue! Each format is processed with its converter so that the behavior may differ. Can you please share the code or sample application with the file that you used to reproduce this issue? Which tools you’re using for performance analysis?

Hello,
After conducting some analyses, it appears that a memory leak occurs when the leaveOpen parameter is set to true. I was unable to find a method to clean up the Large Object Heap (LOH) after executing the conversion.
code:

using var viewer = new Viewer(fileStream, loadOptions, leaveOpen:true);

However, after making some modifications and setting leaveOpen to false , everything seems to be functioning correctly.

@devFordata

Thank you for your feedback. In case leaveOpen is set to true we do not call Dispose on a stream and document object model. It is a bug as it is expected that we keep a stream open and dispose everything else. This issue will be fixed in the further releases.

@devFordata

This topic was moved to