I am using Aspose.PDF 18.6 to produce PDFs that include 3-5 relatively large PNG files (between 100 and 500KB) - not massive. Every once in a while, I have started seeing the following errors:
System.ArgumentException: Invalid image stream (Out of memory.) at Aspose.Pdf.XImageCollection._(Stream _, Int32 _) at Aspose.Pdf.Document._._(OperatorCollection _, Resources _) at Aspose.Pdf.Document._._(Document _) at Aspose.Pdf.Document._(OptimizationOptions _) at Aspose.Pdf.Document.OptimizeResources(OptimizationOptions strategy)
This error is cropping up when calling OptimizeResources. The optimize options are as follows:
optimization.LinkDuplcateStreams = True optimization.RemoveUnusedObjects = True optimization.RemoveUnusedStreams = True optimization.CompressImages = True optimization.ImageQuality = 80
The images have been added as image streams, but all the streams have been tidied up by this point.
This error has only started happening recently and has only happened a few times against thousands of successful processing. The issue is not terminal - i.e. the process can re run the same set up with no issues.
Is this a memory leak in the way Aspose.PDF is marshalling resources?