Using Aspose.Slides on Linux Container with .NET Core Does Not Release Memory

@ansamohdsh,
Thank you for the additional information. I forwarded it to our developers.

@ansamohdsh,
Could you please also share your metrics? For example, what is the memory consumption at the last iteration of the cycle?

image.png (83.8 KB)

image.png (78.8 KB)

I just now triggered 2 ppt downloads, the same ppt that i attached earlier in my code snippet. With each ppt download, the memory spike is of 700-900Mbs and it does not release memory after the operation completes.
No memory is released after the ppt operations.
@andrey.potapov

@ansamohdsh,
Thank you for the additional information. I forwarded it to our developers.

@andrey.potapov We have already purchased a new license and paid support for Aspose.
Please expedite the ticket and share us the update as we have a critical release (May 2023) pending due to it.

Paid support ticket id - #176860

@ansamohdsh,
As far as I can see in our issue-tracking system, the issue has been prioritized. I have requested a special build with a fix for you as soon as possible.

@andrey.potapov Thank you so much for taking this up on priority.
Do you have any timeline by when it would be available ?

@ansamohdsh,
Our developers are already investigating the case. We are awaiting a detailed feedback and ETA this week.

Hello @andrey.potapov
As we are nearing the end of week, just wanted to check back on the status of ticket.
Please let us know if you have any updates for us.

@ansamohdsh,
Our developers are working on the issue. We have requested updates for you again. Unfortunately, I don’t have additional information yet.

@andrey.potapov we are delayed on our My 2023 release to production.
It would be great if you could help us getting the ETA when the fix would be available.

@ansamohdsh,
I requested ETA for the issue from our development team. We will let you know soon.

@ansamohdsh,
Our developers are currently working on identifying the cause of the memory leak. We are striving to resolve the issue as quickly as possible. The ETA depends on the complexity of the problem. We will provide a hotfix as soon as possible. We will keep you updated on any progress.

@ansamohdsh,
Our developers have investigated the case. It was found that the memory leak occurs inside the libgdiplus library (unnamed memory). The memory leak problem is reproduced outside of Aspose.Slides using System.Drawing.Common on Ubuntu 20.04+libgdiplus (6.0.4+dfsg-2). Here is a code sample that reproduces this issue:

for (int i = 0; i < 50; i++)
{
    using (Bitmap bmp = new Bitmap(8 * 1024, 8 * 1024))
    using (Graphics graphics = Graphics.FromImage(bmp))
    {
        graphics.Clear(Color.White);
    }
}

– memory allocated for Bitmap is freed, but the memory for the Graphics object is not freed, graphics.Dispose() doesn’t work. After executing this code, the size of the used memory is about 13 GB and it does not get freed.

Similar problem is described here: System.Drawing.Graphics memory leak · Issue #41262 · dotnet/runtime · GitHub

The memory leak issue was resolved after installing the latest version of the libgdiplus library (6.0.5-0xamarin1+ubuntu2004b1), which comes with Mono: Download - Stable | Mono. It was tested on your presentation file under Docker Ubuntu 20.04 using more than 500 iterations (load and save) and the used memory did not exceed 260 MB during testing.

Here is the updated part of the provided docker script that allows you to install the latest version of the libgdiplus library:

FROM mcr.microsoft.com/dotnet/aspnet:5.0-focal
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections

RUN apt-get update -q && \
apt-get install -y -q gnupg ca-certificates && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \
apt-get update -q && \
DEBIAN_FRONTEND=noninteractive apt-get install -y -q ttf-mscorefonts-installer fontconfig libgdiplus curl && \
fc-cache -vr

We hope this will help to solve the problem.

Thank you @andrey.potapov for your response.
We will test out these changes and let you know soon.

@ansamohdsh,
We will be waiting for your feedback.

Hi @andrey.potapov
Now after doing some testing on our environments, we are getting the below issue by using the docker file updates that you shared with us

image.png (494.4 KB)

@ansamohdsh,
Thank you for reporting on the issue. I’ve forwarded your information to our developers.

@andrey.potapov Also with this PPT, the issue is still replicable. Memory is not released.Sample.zip (1.6 MB)

@ansamohdsh,
Thank you for the sample presentation. We will also investigate the case.