Aspose.Slides Throws OutOfMemoryException Error

Hello, I am in the latest version of aspose A bug was found in slides. My client is using aspose When slides are watermarked, there is an out of memory error. The error is thrown during new representation. There is no problem with the old version of Aspose slides. Please help solve it. The attachment is the problem file.

My environment is Ubuntu, docker container NetCore3.1,aspose. slides. Net version number: 22.6

Thank you.
123.7z (43.6 KB)

1 Like

Thank you for contacting support.

Please share the following additional information:

  • code example that reproduces the exception
  • Ubuntu version
  • dockerfile
  • full stack trace of the error
  1. Exception code location: Presentation presentation = new presentation (filepath)

  2. Ubuntu version: Ubuntu 7.5.0-3ubuntu1~18.04

  3. I’ll give you an official example( Add Watermark to PowerPoint Presentation )The upload file test also failed to add watermark

    • full stack trace of the error: Aspose.Slides.PptxReadException: Out of memory. —> System.OutOfMemoryException: Out of memory. at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status) at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format) at System.Drawing.Bitmap…ctor(Int32 width, Int32 height) at Aspose.Slides.ImageCollection.(e , Size ) at Aspose.Slides.ImageCollection.(ISvgImage , Single , Single , Boolean& ) at Aspose.Slides.ImageCollection.(ISvgImage ) at Aspose.Slides.ImageCollection.AddImage(ISvgImage svgImage) at .(ISlidesPicture ,  , e ) at .(ISlidesPicture ,  , e ) at .(ISlidesPicture , e , e ) at .(PictureFillFormat , e , e ) at .(IPictureFrame ,  , e ) at e.( , IGroupShape , e ) at e.(IGroupShape ,  , e ) at .(IBaseSlide , e , e ) at .(Slide ) at .(IPresentation ) at e.( , IPresentation ) at e.(Presentation , Stream , InterruptionToken ) — End of inner exception stack trace —

Thank you for the additional information. I’ve reproduced the problem with loading the prsentation and added a ticket with ID SLIDESNET-43334 to our issue tracking system. We apologize for any inconvenience. Our development team will investigate the case. You will be notified when the issue is resolved.

Hello, has the problem not been solved yet? Now many abnormal files cause the memory to soar, and the memory is not released

The problem is already resolved. A fix will be included in Aspose.Slides 22.8. This release will be published in the second half of August.

Has the problem of memory not releasing been solved? I downloaded the 52kb file I provided above 100 times, and the memory increased by nearly 1g. If the file itself is larger, the memory will increase more, and the memory will not be released

1 Like


Please share the code example with your measurements that reproduces the problem with increasing memory consumption. We will also check the case.

Just instantiate an object:

using (presentation presentation = new presentation (filepath)) {}

without any operation on the presentation object. I have a 34m file. I only need to instantiate it once, and the container memory will increase by more than 1G, but I can’t upload it. You limit the size of uploaded attachments

Unfortunately, your code example does not show the measurement approach. I’ve used the following code example to measure memory consumption with the presentation file shared above and Aspose.Slides 22.7:

var before = Process.GetCurrentProcess().VirtualMemorySize64;
for (int i = 0; i < 100; i++)
    using (var presentation = new Presentation("123.pptx")) { }
var after = Process.GetCurrentProcess().VirtualMemorySize64;

var result = after - before;
Console.WriteLine(result + " bytes");

My current output is 290 856 960 bytes on Ubuntu 18.04. Please check your results using the version 22.7.

You can share a link to the file saved in a file storage (Google Drive or Dropbox, for example).

Sorry, I can’t access Google. I put the file at this address:

Can you try to download it

I have not managed to reproduce the problem you are experiencing. We need more information on how to do this.

  1. Ubuntu version: Ubuntu 7.5.0-3ubuntu1~18.04
    3.Aspose.slides 22.7
    4.Docker deployment


Could you please share the dockerfile you used?

ARG source

COPY ${source:-obj/Docker/publish} .

RUN mkdir /scripts
&& wget -q http://sd/source/v5/docker-compose/tools/apm-agent/apm-agent -O /usr/local/bin/apm-agent && chmod +x /usr/local/bin/apm-agent
&& wget -q http://sd/source/v5/docker-compose/tools/apm-agent/ -O /scripts/ && chmod +x /scripts/

ADD /scripts/
RUN chmod +x /scripts/

RUN apt-get update
RUN apt-get install -y libgdiplus
RUN cd /usr/lib && ln -s gdiplus.dll
RUN apt-get update && apt-get install -y --no-install-recommends libc6-dev
RUN chmod +x ./MCode64
ENTRYPOINT ["/scripts/"]

Thank you for the dockerfile. I’ve added a ticket with ID SLIDESNET-43391 to our issue tracking system. Our development team will investigate the case. We will inform you of any progress.

Can the memory not be released in the next version?

In addition, before you tested the system with no memory problem, what base package system did you use, not Debian? Can you show your dockerfile? I used your dockerfile to test whether there was a problem

If you are referring to the 52 kB file case, I tested it on Ubuntu 18.04 without Docker. You did not provide the dockerfile before.

A post was split to a new topic: Exceptions Are Thrown when Using Aspose.Slides in a Docker Container

The issues you have found earlier (filed as SLIDESNET-43334) have been fixed in Aspose.Slides for .NET 22.8 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.