Hello!
We are using your Syncfusion.Pdf library and faced with a
memory leak.
byte[] content = …;
byte[] xmlFormData = …;
using (var pdfInStream = new MemoryStream(content, false))
using (var pdfDocument = new PdfLoadedDocument(pdfInStream))
using (var xmlFormDataStream = new MemoryStream(xmlFormData))
{
pdfDocument.Form.ImportDataXFDF(xmlFormDataStream);
pdfDocument.Form.Flatten = true;
using (var pdfDocumentStream = new MemoryStream())
{
pdfDocument.Save(pdfDocumentStream);
pdfDocumentStream.Seek(0, SeekOrigin.Begin);
return
pdfDocumentStream.ToArray();
}
}
After running this code multiple times memory fills with a
big amount of objects that can’t be garbage collected:
Syncfusion.Pdf.Graphics.Fonts.StandardWidthTable
Syncfusion.Pdf.Graphics.Fonts.PdfFontMetrics
Syncfusion.Pdf.Graphics.PdfTrueTypeFont
Service gets bigger and bigger and eventually hangs.
The reason is the static s_cache variable in
Syncfusion.Pdf.PdfDocument class, that stores all the references to this
objects:
The problem exists in 14.3451.0.49 library version.
Can you please assist us with this?