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

Free Support Forum - aspose.com

Memory intensive processing

Our application has been using Aspose.Words for quite some time now, and never had any issue with it.

We just recently started using Aspose.PDF to get a page count from pdf and word document files. Also to merge multiple PDF and word docs into a single pdf document. Here is where our problems are.

When getting the page count, the memory usage drops back down upon completion, but creating the combined PDF, it appears to run out to lunch with the memory, and when it’s done, memory usage stays at the new higher level and never comes back down.

Our application is a web application running in IIS, so killing the application isn’t an option. I followed the documentation here to write the code to perform these functions. The only other approach I can see is to write out a temp file to the disk, instead of doing everything in memory, but this can be a very time consuming process, and we run the risk of IIS timing out. Do we have any other alternatives?

Hi Darren,

Can you please confirm that either you are using the Facades approach or using the new DOM API approach for concatenating the PDF documents. If you haven’t tested the new DOM API approach to merge the PDF files, I would suggest you to please try using it and see if it can resolve your problem. In fact we recently have introduced the new DOM API approach and its memory management is bit better as compare to Facades approach.

More along, please share some details regarding number of PDF documents that you are trying to merge, size of these documents and some details regarding your working environment.

If possible, can you please share some sample PDF documents so that we can test the scenario at our end. We apologize for this inconvenience.

Our code looks like this

pdfDoc =

new Aspose.Pdf.Document(docName);


The file in use is a 28MB pdf that I created a copy of and merged the two copies together. I've done this several times over, and created a 500MB file for testing. We are using the 500MB file to try to accurately simlulate a specific user's usage pattern. Last attempt was two 300MB and one 500MB files being merged.

Hi Darren,

Thanks for sharing the details.

I have tested the PDF merge scenario and have observed some issues in this functionality. For the sake of correction, I have logged it as PDFNEWNET-30930 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We apologize for this inconvenience.

PS, During my testing, I have tried merging two PDF files of size 314MB and 392MB and I am encountering OutOfMemoryException.

Thank you very much. I should also note that we also experienced out of memory exceptions in 32bit mode, but do not get them on 64bit, instead we’d get memory usages in the 4+ GB range.

Hi Darren,

During my testing,
I was able to notice this issue over Windows7 X64 professional, VisualStudio 2010 ultimate over Intel i5 2.79 GHz with 8GB RAM but we will ensure that the problem does not occur on both X86 and X64 architecture. Please be patient and spare us little time.

I am being asked for updates regarding this issue. Is there any new information from your side I can relay to my superiors?

Hi Darren,

Thanks for your patience. Our development team is working hard to get this issue resolved but I am afraid its not yet completely fixed. Nevertheless, I have requested them to share the ETA regarding its resolution. Please be patient and spare us little time. Soon you will be updated with the status of correction.

Has there been any new developments that I can report to my bosses?

Hi Darren,

Thanks for your patience. We have made some progress towards the resolution of this problem and the issue seems to be fixed in latest release version of Aspose.Pdf for .NET 6.4.2. For the sake of testing, I have tried concatenating two PDF documents (one with size 1.7GB and the other having 537MB size) and I am unable to notice any problem. Can you please try using the latest version of Aspose.Pdf for.NET and in case the problem still persists, please feel free to contact. We apologize for your inconvenience.

Unfortunately, the problem does still exist, just not to the severity as before. With further investigation on our end, we have noticed a few areas where we can optimize memory use. We will be performing this optimization, and will let you know of the results.

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

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