Out Of Memory during watermark check

We use 20.7 version of aspose slides.
Application exited with out of memory error.
When we check the heap dump we noticed the threads hold the same objects in heap as shown below
image.png (120.0 KB)

Also jvm log has details like below

<dependency_failed type=‘leaf_type’ ctxk=‘java/awt/image/BufferedImage’ witness=‘com/aspose/slides/internal/gz/case’ stamp=‘248240.400’/>
<dependency_failed type=‘unique_concrete_method’ ctxk=‘java/awt/image/BufferedImage’ x=‘java/awt/image/BufferedImage getRaster ()Ljava/awt/image/WritableRaster;’ witness=‘com/aspose/slides/internal/gz/case’ stamp=‘248240.400’/>
<dependency_failed type=‘unique_concrete_method’ ctxk=‘java/awt/image/BufferedImage’ x=‘java/awt/image/BufferedImage getRaster ()Ljava/awt/image/WritableRaster;’ witness=‘com/aspose/slides/internal/gz/case’ stamp=‘248240.400’/>

PPTx files roughly less than 10MB.
images size in that file is 9MB
image.png (6.0 KB)

How to fix this heap problem ?

sample code

Presentation presentation = new Presentation(inputStream);

    ISlideCollection slides = presentation.getSlides();
    int totalSlides = slides.size();
    for (int no = 0; no < totalSlides; no++) {
        ISlide slide = slides.get_Item(no);
        IShapeCollection shapes = slide.getShapes();
        if (null == shapes) {
            continue;
        }
       
        for (IShape iShape : shapes) {
            if (iShape.getName().equals("MyShapeName")) {
                IAutoShape iAutoShape = (IAutoShape) iShape;
                if (iAutoShape.getTextFrame().getText().equals(watermarkText)) {
                   
                     return true;
                }
            }
        }
    }

@vgcnerella2019,
Thank you for the issue description.

Could you please share the presentation files to investigate the problem?

To my regret, we cannot reproduce the problem because your code snippet contains unknown symbols (inputStream and watermarkText). Could you please share a complete code sample?

I can not share the file as it is customer related.
I modified the code.
I wanted to know is there any settings to avoid loading BufferedImage objects into memory ?
Was there any minimum memory configuration required to load parallel 5 pptx files and work on them ?

Presentation presentation = new Presentation("/Home/testFile.pptx");
ISlideCollection slides = presentation.getSlides();
int totalSlides = slides.size();
for (int no = 0; no < totalSlides; no++) {
ISlide slide = slides.get_Item(no);
IShapeCollection shapes = slide.getShapes();
if (null == shapes) {
continue;
}

    for (IShape iShape : shapes) {
        if (iShape.getName().equals("MyShapeName")) {
            IAutoShape iAutoShape = (IAutoShape) iShape;
            if (iAutoShape.getTextFrame().getText().equals("watermarkText")) {
               
                 return true;
            }
        }
    }
}

@vgcnerella2019,
Reducing memory consumption can be achieved by using disk space. A presentation content has to be stored on the disk to keep your memory consumption low. Try the large presentations as below:

LoadOptions loadOptions = new LoadOptions();
loadOptions.getBlobManagementOptions().setPresentationLockingBehavior(PresentationLockingBehavior.KeepLocked);
loadOptions.getBlobManagementOptions().setMaxBlobsBytesInMemory(maxByteCount);
loadOptions.getBlobManagementOptions().setTemporaryFilesAllowed(true);
loadOptions.getBlobManagementOptions().setTempFilesRootPath(tempFilesPath);

Presentation presentation = new Presentation(largePresentationFilePath, loadOptions);

API Reference: IBlobManagementOptions interface