unmanaged memory lead during printing
Posted: Tue Oct 15, 2013 11:42 am
In our application server we create printjobs by calling renderedReport.SaveDocumentToByteArray(). Later we print these jobs in another process. The problem is, that some reports (bytearray and mrt are included) especially with background images permanently increase the memory usage of the print process. I have included a simple one page example that increases the memory footprint for about 120MB. With memory profiler we found that this leak is not managed but unmanaged memory.
Version: 2013.2.1700; .NET 4.5
i have uploaded the bytearray-bin-File an the original mrt-File
Version: 2013.2.1700; .NET 4.5
i have uploaded the bytearray-bin-File an the original mrt-File
Code: Select all
[Test]
public void StimulMemoryBug() {
var saveDocumentToByteArray = File.ReadAllBytes(@"testdata\reportprint\serialized.bin"); // created with renderedReport.SaveDocumentToByteArray();
var defaultprinter = PrinterSettings.InstalledPrinters.Cast<string>()
.Select(s => new PrinterSettings { PrinterName = s })
.First(t => t.IsDefaultPrinter);
Console.Out.WriteLine(Process.GetCurrentProcess().PrivateMemorySize64); // Output is 24.088.576
using (var report = new StiReport()) {
report.LoadDocument(saveDocumentToByteArray);
report.Print(false, defaultprinter);
}
Console.Out.WriteLine(Process.GetCurrentProcess().PrivateMemorySize64); //120MB! Difference Output is 146.366.464
}