We are using Aspose to convert PDFs to PDF/A but the Convert-method in the latest version, 24.9, has a significant memory leak. The memory leak can be demonstrated with the code below. Debugg the test in a Microsoft Unit Test project and watch the amount of memory used by the process climb. Comment out the Convert line and the memory leak goes away.
using System.Net;
namespace TestAsposeConvert
{
[TestClass]
public class MemoryLeakTest
{
[TestMethod]
public void PdfConvertLeaksMemory()
{
var client = new WebClient();
using (var pdfStream = new MemoryStream(client.DownloadData("https://s3.us-west-2.amazonaws.com/aspose.files/Corporate/Brochures/d6b7973eea4d43529e53268f0c7864ea/All/Brochure_-_Aspose.3D_for_.NET.pdf")))
{
for (int i = 0; i < 10000; i++)
{
using (var pdf = new Aspose.Pdf.Document(pdfStream))
{
var conversionOptions = new Aspose.Pdf.PdfFormatConversionOptions(Aspose.Pdf.PdfFormat.PDF_A_2A) { };
// Comment out this line to avoid the memory leak:
pdf.Convert(conversionOptions);
}
}
}
}
}
}