Hi,
we are using PDF generation in Xamarin.iOS and we found some memory problems when generating the pdf using PdfTrueTypeFont, with version 13.3451.0.7 Suncfusion.*.Portable.dll.
We use arialuni.ttf (comes with Windows as Arial Unicode).
Well, when our app starts and the memory consumption is low, the generation goes well. Using Instruments, the memory appears to be at aceptable ranges.
But, if the app is consuming some more memory (i simulate this declaring some byte arrays of ~300 or ~400 MB) and them generate some PDF files, the app crashes because low memory (previously some DidReceiveMemoryWarning occurred but ignored for test purposes). The number of generated pdf files is very low, about 10-15.
In each generation, we are creating a FileStream for de TTF file, and then creating de font. Finally, we dispose the elements.
FileStream fontStream = new FileStream (Path.Combine (Environment.CurrentDirectory, "ttf", "arialuni.ttf"), FileMode.Open, FileAccess.Read, FileShare.Read)
PdfTrueTypeFont myFont = new PdfTrueTypeFont (fontStream, 8);
// Generate PDF
if (myFont != null)
{
myFont.Dispose ();
myFont = null;
}
if (fontStream != null)
{
fontStream.Close ();
fontStream.Dispose ();
fontStream = null;
}
The question is, are we doing something wrong? Are fonts correctly disposed or is something more necessary to free the memory used?
We work-arround that, declaring the FileStream and PdfTrueTypeFont static, but we don't like the solution at all.
Thanks in advance,
Benito.