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,
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.
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,
As far as I can see, our developers continue to work on this issue this week. Unfortunately, I don’t have any additional information yet.
hello @andrey.potapov,
As we are approaching weekend, wanted to check with you if you have any updates for us ?
@ansamohdsh,
I requested news on the issue from our development team and will let you know as soon as possible.
@ansamohdsh,
We are currently working on identifying the cause of the error that occurs during the build process of your Dockerfile. We are attempting to reproduce the issue locally.
Could you please provide the Dockerfile or the relevant part of the Dockerfile where the provided script for updating the libgdiplus
library is used? The memory leak issue can be resolved by installing the latest version of the libgdiplus
library (6.0.5-0xamarin1+ubuntu2004b1), which comes with Mono:
https://www.mono-project.com/download/stable/#download-lin
@andrey.potapov We are using the snippet that you shared with us in the last update as below:
FROM mcr.microsoft.com/dotnet/aspnet:7.0-focal
#FROM mcr.microsoft.com/dotnet/aspnet:5.0-focal
#FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine
# RUN echo -e "https://dl-cdn.alpinelinux.org/alpine/edge/testing/\n" >> /etc/apk/repositories && \
# apk update && \
# apk --no-cache add msttcorefonts-installer fontconfig libgdiplus icu-libs curl && \
# update-ms-fonts && \
# fc-cache -f
# RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
# RUN apt-get update -q && \
# DEBIAN_FRONTEND=noninteractive apt-get install ttf-mscorefonts-installer fontconfig libgdiplus curl -y -q && \
# fc-cache -vr
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
WORKDIR /app
COPY bin/Release/net7.0/publish/ /app/
RUN mkdir obj logs && chown nobody obj logs && apt-get remove -q -y curl
# RUN mkdir obj logs && chown nobody obj logs && apk del curl
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
# USER nobody
ENTRYPOINT ["dotnet", "SomeDLL.dll"]
@ansamohdsh,
Our developers have investigated your log and Dockerfile. Based on the provided log, the ttf-mscorefonts-installer
package is unavailable. It’s important to note that for Aspose.Slides under aspnet:6.0-7.0, there’s no need to install the libgdiplus
library in the Linux environment. This is because, starting from .NET 6.0, Aspose.Slides no longer relies on the libgdiplus
library. Microsoft has discontinued support for System.Drawing.Common
in the Linux environment beginning with .NET 6.0. Therefore, installing the latest version of the libgdiplus
library is unnecessary under .NET 6.0 and .NET 7.0. The previously provided Dockerfile script was developed for .NET 5.0 to update the libgdiplus
library, aiming to fix the memory leak issue.
Here is the Dockerfile for .NET 6.0 and .NET 7.0 with some comments:
#FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal AS base
#FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
#FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
#FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base
#Uncomment to install the ttf-mscorefonts-installer for aspnet:6.0 (runtime:6.0) and aspnet:7.0 (runtime 7.0). Please comment it out for aspnet:x.x-focal, as it doesn't work.
RUN echo "deb http://deb.debian.org/debian/ buster main contrib non-free" > /etc/apt/sources.list && \
echo "deb-src http://deb.debian.org/debian/ buster main contrib non-free" >> /etc/apt/sources.list
#The libgdiplus package can be removed if you'd like
RUN apt-get update -q && \
DEBIAN_FRONTEND=noninteractive apt-get install -y -q ttf-mscorefonts-installer fontconfig libgdiplus curl && \
fc-cache -vr
#Install the necessary libraries for Aspose.Slides under .NET 6.0 and .NET 7.0, as they may be missing in the Docker image
RUN apt-get update && apt-get install -y \
libfontconfig1 \
libfreetype6 \
libexpat1 \
libpng16-16
WORKDIR /app
#FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["SomeDLL/SomeDLL.csproj", "SomeDLL/"]
RUN dotnet restore "SomeDLL/SomeDLL.csproj"
COPY . .
WORKDIR "/src/SomeDLL"
RUN dotnet build "SomeDLL.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SomeDLL.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SomeDLL.dll"]
Please note that for .NET 6.0 and .NET 7.0 were added the following commands to the Dockerfile:
RUN apt-get update && apt-get install -y \
libfontconfig1 \
libfreetype6 \
libexpat1 \
libpng16-16
These commands install the necessary libraries for Aspose.Slides in the Linux environment under .NET 6.0 and .NET 7.0, which may be missing in the docker image.
Updated Dockerfile for .NET 5.0, just in case:
FROM mcr.microsoft.com/dotnet/aspnet:5.0-focal AS base
#FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
#FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base
# Uncomment to install the ttf-mscorefonts-installer for aspnet:5.0 and runtime:5.0. Please comment it out for aspnet:5.0-focal, as it doesn't
#RUN echo "deb http://deb.debian.org/debian/ buster main contrib non-free" > /etc/apt/sources.list && \
#echo "deb-src http://deb.debian.org/debian/ buster main contrib non-free" >> /etc/apt/sources.list
# Update package lists, install the necessary packages and Update font caches
RUN apt-get update -q
ENV DEBIAN_FRONTEND=noninteractive
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
RUN apt-get install -y -q ttf-mscorefonts-installer fontconfig curl
RUN fc-cache -vr
# Install the latest version of libgdiplus library for aspnet:5.0, runtime:5.0 and aspnet:5.0-focal to resolve memory leak
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 && \
#Uncomment this code for aspnet:5.0 and runtime:5.0. Comment it out for aspnet:5.0-focal because it doesn't work
#echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \
#Uncomment this code for aspnet:5.0-focal. However, you should comment it out for aspnet:5.0 and runtime:5.0, as it doesn't work.
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 && \
apt-get install -y -q libgdiplus
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["SomeDLL/SomeDLL.csproj", "SomeDLL/"]
RUN dotnet restore "SomeDLL/SomeDLL.csproj"
COPY . .
WORKDIR "/src/SomeDLL"
RUN dotnet build "SomeDLL.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SomeDLL.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SomeDLL.dll"]