Free Support Forum - aspose.com

Resource leak in MailPrinter

I’m attempting to use Aspose.Email.Printing.MailPrinter to convert a .MSG to a PDF through an intermediate XPS file. (I’ve already tried the MHTML route with other issues).


There appears to be a severe handle and/or memory leak when using the MailPrinter to create either a XPS or TIFF file. Running this simplified example will cause the handle count and memory to increase without being collected. We’ve found about 5000 iterations is enough to make the system unstable (can no longer open task manager, etc…)


public static void HandleLeak()
{
for (int i = 0; i < 5000; i++)
{
using (var ms = new MemoryStream())
{
using (var message = new MailMessage(“me@localhost”, “you@localhost”, “test subject”, “test body”))
{
var printer = new MailPrinter() {FormattingFlags = MessageFormattingFlags.MailInfo};
printer.Print(message, ms, PrintFormat.XPS);
}
}
}
}

Hi Barry,


Thanks for writing to Aspose.Email support team.

I have analyzed the provided sample code and have re-produced the issue here. All this information is passed to the developer along with the sample code. I will write back here on the forum as soon as some feedback is received from the development team.

This issue is logged in our issue tracking system as NETWORKNET-33608.

The issues you have found earlier (filed as NETWORKNET-33608) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.