High Memory Consumption when Saving PowerPoint Presentation in C#

Environment:
Linux Ubuntu x86_64 docker
.NETCORE 3.1
aspose.slides.net 23.1

Problem:

Open a 35M pptx file and save it. The memory increases by 1G.
The memory is not released, and the memory for repeated operations keeps increasing.

LoadOptions loadOptions = new LoadOptions
{
    BlobManagementOptions = new BlobManagementOptions
    {
        PresentationLockingBehavior = PresentationLockingBehavior.KeepLocked,
        IsTemporaryFilesAllowed = true
    }
};
using (Presentation presentation = new Presentation(filePath, loadOptions))
{
    string dirPath = Path.GetDirectoryName(filePath);
    string name = Guid.NewGuid().ToString("N") + extName;
    string newFilePath = Path.Combine(dirPath, name);
    presentation.Save(newFilePath, SaveFormat.Pptx);
}

dotnet-dump info:

GC gen2(fraction info)

00007f32452d2c18    12729       407328 System.Collections.Generic.List<Aspose.Slides.IColorOperation>
00007f32453bd548     4885       429880 
00007f324545c700     5905       472400 Aspose.Slides.Portion
00007f324519c148     4010       481200 Aspose.Slides.BulletFormat
00007f3245198c68     3666       498576 
00007f32452d26b8    12729       509160 Aspose.Slides.ColorOperationCollection
00007f3244635728      241       514232 System.Int64[]
00007f32452cfe00     6224       547712 Aspose.Slides.PictureFillFormat
00007f32452d0880     6316       555808 Aspose.Slides.GradientFormat
00007f32452d0cf8     6316       555808 Aspose.Slides.PatternFormat
00007f324519e508    10028       561568 
00007f3245443c58     2138       564432 Aspose.Slides.AutoShape
00007f32452d28c8     8846       566144 
00007f32452d0e98     9131       584384 
00007f32452d1518    12729       610992 
00007f324541a358     4070       618640 
00007f323f7314c0     2537       676102 System.Byte[]
00007f32443af1b8    17630       705200 System.Xml.NameTable+Entry
00007f32453c52f0    14451       809256 
00007f3245196538     6475       828800 Aspose.Slides.ParagraphFormat
00007f324519fc10    10859       868720 Aspose.Slides.EffectFormat
00007f32452d1d18    12729      1018320 
00007f324519ce30    10028      1363808 Aspose.Slides.PortionFormat
00007f32452cd1e0     7042      1577408 
00007f324519f1e8    23748      2469792 Aspose.Slides.LineFormat
00007f324519e810    24632      2758784 Aspose.Slides.FillFormat
00007f324519e188    27151      2823704 Aspose.Slides.ColorFormat
00007f323f730f90    56332      3686968 System.String
Total 680453 objects
do 00007f30b03dd780
Name:        System.String
MethodTable: 00007f323f730f90
EEClass:     00007f323f69e230
Size:        1008(0x3f0) bytes
File:        /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.20/System.Private.CoreLib.dll
String:      <a:ext uri="{BEBA8EAE-BF5A-486C-A8C5-ECC9F3942E4B}" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a14:imgProps xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"><a14:imgLayer r:embed="rId2" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><a14:imgEffect><a14:brightnessContrast bright="-40000" contrast="20000" /></a14:imgEffect><a14:imgEffect><a14:saturation sat="200000" /></a14:imgEffect></a14:imgLayer></a14:imgProps></a:ext>
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
00007f323f72a0e8  400022a        8         System.Int32  1 instance              493 _stringLength
00007f323f726f00  400022b        c          System.Char  1 instance               3c _firstChar
00007f323f730f90  400022c      108        System.String  0   static 00007f2eaffff360 Empty
do 00007f30b043b4b0                                                                                                                                                              
Name:        System.String
MethodTable: 00007f323f730f90
EEClass:     00007f323f69e230
Size:        630(0x276) bytes
File:        /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.20/System.Private.CoreLib.dll
String:      <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId2" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" /></a:ext>
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
00007f323f72a0e8  400022a        8         System.Int32  1 instance              304 _stringLength
00007f323f726f00  400022b        c          System.Char  1 instance               3c _firstChar
00007f323f730f90  400022c      108        System.String  0   static 00007f2eaffff360 Empty

@celerycabbage2022,
Thank you for describing the issue.

Please also try using the BlobManagementOptions.MaxBlobsBytesInMemory and BlobManagementOptions.TempFilesRootPath properties. If the issue persists, please share the following files:

  • input presentation file
  • dockerfile you used

Thank you for your reply,I have try to use your suggestion but it‘s without effect.

My example like this:

LoadOptions loadOptions = new LoadOptions
{
    BlobManagementOptions = new BlobManagementOptions
    {
        PresentationLockingBehavior = PresentationLockingBehavior.KeepLocked,
        MaxBlobsBytesInMemory = 1 * 1024 * 1024,
        IsTemporaryFilesAllowed = true
    }
};

I think there is no ‘big object’ in my ppt file.
I want to know why many Gen2 objects are generated after opening the ppt file.
It is difficult to release Gen2 objects, which eventually leads to memory rising.

The dockfile content as below:

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} .


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"]

The ppt file download url:https://v5.edoc2.com/outpublish.html?code=Aaa582bc111fe4d43a8d6fc0c1cbfc078&lang=zh-cn#view

@celerycabbage2022,
Thank you for the additional information.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-43794

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

I find a possible reason that causes memory rise when open the pptx file is the pptx file contains .svg file.

@celerycabbage2022,
Thank you for your help. I added your information to the issue ticket.

Is there any new progress.

@celerycabbage2022,
Unfortunately, the issue has not been scheduled for investigation yet. We apologize for any inconvenience.

Please make arrangements as soon as possible, thank you.

@celerycabbage2022,
Our development team will do their best to resolve the issue as soon as possible.

Hi,Is there has any progress this week.

@celerycabbage2022,
I requested plans for the issue from our development team for you. We will let you know ASAP.

Has the development team started to deal with this problem.

@celerycabbage2022,
I am still waiting for a response from our development team.

Hi,Is there has any progress.

@celerycabbage2022,
Unfortunately, I don’t have any news for you yet.

The problem has been for a long time.Is there no progress at all?

@celerycabbage2022,
I am still waiting for a response from our development team and will notify you of any progress.

Hi,Is there has any progress.

@celerycabbage2022,
I requested plans for the issue from our development team again. I will let you know about them as soon as I get a response. Thank you for your patience.