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

Free Support Forum - aspose.com

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

@rainwzy,
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( https://products.aspose.app/slides/watermark )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 —

@rainwzy,
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

@rainwzy,
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

@rainwzy,

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

@rainwzy,
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:
https://v5.edoc2.com/outpublish.html?code=A622ac70714ba43bd856bc46d1bed435b&lang=en#view

Can you try to download it

@rainwzy,
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
    2…NetCore3.1
    3.Aspose.slides 22.7
    4.Docker deployment

@rainwzy,

Could you please share the dockerfile you used?

FROM registry.edoc2.com:5000/edoc2v5/dotnet3.1-deps:runtime-deps-3.1-debian11-fonts-20211026
ARG source

WORKDIR /app
EXPOSE 6261
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/agent-start.sh -O /scripts/agent-start.sh && chmod +x /scripts/agent-start.sh

ADD docker-entrypoint-transport.sh /scripts/docker-entrypoint-transport.sh
RUN chmod +x /scripts/docker-entrypoint-transport.sh

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

@rainwzy,
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

@rainwzy,
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.