We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Concatenate method of pdfFileEditor is concatenating files properly but not releasing the memory

Concatenate method of pdfFileEditor is concatenating files properly but not releasing the memory. I verified this using Task Manager and the memory gets freed up only after the application gets terminated.

Here is the code snippett:

string[] inputstream = new string[flag];

int counter = 0;

foreach (string fileName in inputArray)


inputstream[counter] = fileName;

counter = counter + 1;


concatenatepdf = Path.Combine(path, "concatenatepdf.pdf");

tempFile = Path.Combine(path, "tempFile.pdf");

//outputPdf = Path.Combine(path, "mergedPdf.pdf"); Outputfile

//string date = DateTime.Now.Date.ToString() ;

//string time = DateTime.Now.TimeOfDay.ToString() ;

//string outputfileName = "Outputfile" + date + time;

outputPdf = Path.Combine(dirpath, "Outputfile.pdf");

PdfFileEditor pdfEditor = new PdfFileEditor();

pdfEditor.Concatenate (inputstream, concatenatepdf);

pdfEditor = null;


I've looked through the related code in our component and found no problem with it about releasing memory. I think the problem should be caused by the GC policy of .NET.


pdfEditor = null;




Thanks, this will release any memory at the end of the concatenation, problem I am facing with Aspose pdfEditor's concatenate is that when there are large number of files in the input stream to be concatenated it keeps on increasing the memory consumption till the time application chokes. As a test I created a desktop application to merge files. The resultant output was just 160 MB but it took a long time and overwhelming 1.5 GB of total 2 GB Primary memory for the concatenation process!!!. It choked and then timed out / gave memory errors when I used the same process on a PC with 512 MB of memory.

Please help and advise on what is the reason that it requires 1.5 GB of primary memory to concatenate just 160 MB of data.

It is a known issue that the concatenation method needs a lot of memory. We are working to optimize this issue but I am afraid we can’t reduce the memory usuage much in short time. Sorry for the inconvenience.