I hope you can help with an ugly memory problem. We have a batch job that creates Aspose.Words documents by grabbing blobs from an Oracle database, and then prints each document and saves it to a network share. This job creates a large number of documents each time it runs.
When I run the batch job, it builds up memory until the batch server runs out of free memory.
When I debug the job, I see that the memory footprint goes up about 10MB every time it prints, and that memory is never freed back up again.
I'm declaring one Aspose.Words.Document object at the beginning of the job as Public, and re-using it for each new document I create. I use three other objects (all declared Public, like the document) in the batch job; DocumentBuilder, AsposeWordsPrintDocument and System.Drawing.Printing.PrinterSettings. I'm gettting rid of the AsposeWordsPrintDocument and PrinterSettings objects each time I print, and calling GC, like this:
m_awPrintDoc = Nothing
m_printerSettings = Nothing
After GC.Collect runs, I get about 3MB of memory back, but that leaves about 7MB building up each time I print.
Do I need to declare the Aspose.Words.Document and DocumentBuilder locally, and dispose of them each time? I'd rather not, since I need those objects to persist into another part of the batch job.
Thanks for any help you can give.