PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Memory leak while using XpsConverter.Convert to create pdf
http://forum.pdfsharp.com/viewtopic.php?f=3&t=4176
Page 1 of 1

Author:  vineeth [ Mon Sep 21, 2020 9:19 am ]
Post subject:  Memory leak while using XpsConverter.Convert to create pdf

Hi,

Below code is used to create a pdf file of 4 pages

var pdfXpsDoc = PdfSharp.Xps.XpsModel.XpsDocument.Open(lMemoryStream);
PdfSharp.Xps.XpsConverter.Convert(pdfXpsDoc, fileName, 0);

But it cause memory leak if call multiple times, say 100.

On analysis, it is found that the "table" member of type "Dictionary" in FontDescriptorStock class is holding the objects.

Could you please help?

Note: We are using 1.32 version. But, it does not contain PdfSharp.xps module. So, i copied the used the module from 1.31 version.

Author:  TH-Soft [ Mon Sep 21, 2020 9:49 am ]
Post subject:  Re: Memory leak while using XpsConverter.Convert to create p

Font handling has been reworked for version 1.50. I don't know if the XPS code works with version 1.5x.

Unlikely that someone will investigate possible memory leaks of version 1.32 anymore.

Author:  vineeth [ Mon Sep 21, 2020 12:05 pm ]
Post subject:  Re: Memory leak while using XpsConverter.Convert to create p

Hi,

Thanks for the update.

Will I be able to save my xps document to pdf file using v1.50?

Also, v1.50 is mentioned as "beta" in sourceforge.net.

Thanks,
Vineeth

Author:  TH-Soft [ Wed Sep 23, 2020 10:29 am ]
Post subject:  Re: Memory leak while using XpsConverter.Convert to create p

1.50 is stable on GitHub, 1.51 is beta.

Author:  vineeth [ Thu Sep 24, 2020 10:01 am ]
Post subject:  Re: Memory leak while using XpsConverter.Convert to create p

Will it be able to work below code with 1.50 version?

var pdfXpsDoc = PdfSharp.Xps.XpsModel.XpsDocument.Open(lMemoryStream);
PdfSharp.Xps.XpsConverter.Convert(pdfXpsDoc, fileName, 0);

OR
Do you have any recommendation to achieve my task using latest 1.50 version?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/