Free Support Forum - aspose.com

Aspose.Word 6.0.1.0 SaveAsPdf in a loop memory leak OutOfMemoryException

Hi support,

I detect some memory leak when I use SaveAsPdf in a loop.

The memory increase until 1.7 Gb just before OutOfMemoryException occurred during the 1442 document loop.

May be it's the similar 6863 problem.

I join one of the 2000 identical .docx file

Here is my C# code :

using System;

using Aspose.Words;

namespace MyconsoleAppLoop

{

class Program

{

static void Main(string[] args)

{

Aspose.Words.License license = new Aspose.Words.License();

license.SetLicense("Aspose.Words.lic");

int loop = 1;

if (args.Length > 1) int.TryParse(args[1], out loop);

for (int i = 1; i <= loop; i++)

{

Console.WriteLine(i);

string fileNameDocX = args[0] + "." + i + ".docx";

string fileNamePdf = args[0] + "." + i + ".pdf";

Console.WriteLine("Debut " + fileNameDocX);

Aspose.Words.Document mDocument;

mDocument = new Aspose.Words.Document(fileNameDocX);

mDocument.Save(fileNamePdf);

Console.WriteLine("Fin");

}

}

}

}

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I cannot reproduce the problem on my side. I used the following code for testing:

Document doc = new Document(@"Test085\cpestel.docx");

doc.Save(@"Test085\out.pdf");

Conversion takes a second or less. Are you sure, you attached a correct file? Also maybe you can provide some additional information that will allow me to reproduce the problem.

Best regards.

Hi Alexey,

This problem happen when you execute a saveAsPdf "for loop" on this document.

Best regards.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I used also the following code and still no problems:

for (int i = 0; i < 10; i++)

{

Document doc = new Document(@"Test085\in.docx");

doc.Save(String.Format(@"Test085\out_{0}.pdf", i));

}

Best regards.

Hi,

Please, increase your i max from 10 to 2000.

Crash occur when i=1440. The last 10 conversions before crash, take more long time.

for (int i = 0; i < 2000; i++)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

{

Document doc = new Document(@"Test085\in.docx");

doc.Save(String.Format(@"Test085\out_{0}.pdf", i));

}

Best regards.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce the problem and created new issue #7179 in our defect database.

It takes 3662 iterations to reproduce the problem on my side.

Best regards.

Is this an Aspose issue or Garbage collection issue?
If you have GC.Collect() every 500 iteration or so, will it still produce the same error?

I don't use garbage. See my code in this thread.

If I try with another docx document, memory don't increase during 2000 iterations.

The problem occur only with cpestel.docx document.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for additional information and interest to this issue. We will further investigate the problem and provide you more information.

Best regards.

Hello,

the Problem is still in Version 6.1.0.0…
Can you provide a estimated date when a fix will be available?

Yours,
Egon

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. The issue is already fixed in the current codebase. The next release will be published in 1-2 weeks.

Best regards.

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

Hi Alex,

We still facing some pdf redition problem with Aspose.words version 8.0 similar as version 6.2, currently we are using Aspose.words 5.3, are you still supporting version 5.3?

Thanks,

Christina

Hi Christina,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You can use old versions of Aspose.Words if you are satisfied with them. But you should note, all fixes and new feature are always added in new versions only.

Could you please attach the document, which will allow me to reproduce the memory leak issue?

Best regards.