Aspose Slides using a lot of memory for generating a small ppt

Hi,

I am trying to generate a PowerPoint report using Aspose slides for .NET. I am using version 17.9. The problem started with Out of Memory exception. After the process took around 1.4 GB memory, it was failing. I was able to work around this by doing -

  • Updating Aspose.Slides.dll from 15.6 to 17.9

  • Changing my calling windows app to compile for x64

I can now generate the report just fine, but the memory used by the process just doesn’t get cleared up.

Basically I need multiple slides with tables and a small image on each slide. The data then gets filled into the tables dynamically and rows are also added dynamically. When cloning a slide to generate multiple other similar slides, the memory grows very quickly. When calling the Save method, memory usage almost more than doubles up and never gets released.

Sample code -

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aspose.Slides;
using Aspose.Slides.Export;
using System.IO;

namespace Apose_Slides_Cloning
{
class Program
{
static void Main(string[] args)
{
License license = new License();
license.SetLicense(File.OpenRead(@“C:\Aspose.Slides.lic”));
Presentation samplePPT = new Presentation(@“C:\Logs\SamplePPTX.pptx”);
using (Presentation blankPresentaion = new Presentation())
{
//ISlide templateSlide = blankPresentaion.Slides[0];
ISlide templateSlide = samplePPT.Slides[0];
ISlide templateSlideCopy = blankPresentaion.Slides.AddClone(templateSlide);

            Console.WriteLine("Starting to add slides");

            for (int slideIndex = 0; slideIndex < 400; slideIndex++)
            {
                blankPresentaion.Slides.AddClone(templateSlide);

                if (slideIndex % 5 == 0)
                {
                    Console.WriteLine("Writing slide number: - " + slideIndex);
                }
            }
            blankPresentaion.Slides.Remove(templateSlideCopy);
            blankPresentaion.Slides.RemoveAt(0);
            Console.WriteLine("All slides written successfully. Starting to save presentation.");
            blankPresentaion.Save(@"C:\Ayush.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
            blankPresentaion.Dispose();
        }
        Console.WriteLine("Presentation saved successfully.");
        Console.ReadLine();        
    }
}

}

If I use a layout slide and clone a slide using that layout, the process is very quick but I need to access and edit shapes/objects on the layout independently on every slide. As such, layout slide doesn’t work for me.

What is strange is that my actual final report is only about 3 MB in size while during generation, memory used touches close to 3.8 - 4 GB

@ayush.kapoor,

I have observed your comments. Can you please try to use Aspose.Slides latest version 17.12 on your end and if there is still an issue than please share environment details along with source files so that we may further investigate to help you out.

Thanks Adnan. I have tried version 17.12 unsuccessfully. The same memory management issue. I will share the code/files soon.

@ayush.kapoor,

sure, please share requested files so that we may proceed further to help you out.

Program.zip (88.4 KB)

Please try with any latest version of aspose slides dll. You might need to make small code changes like dll reference path etc.
Will wait for your response.
Thanks

@ayush.kapoor,

I observed your comments. An issue with ID SLIDESNET-39722 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

Hi Adnan,

Any progress on this issue?

I have come across various similar problems on Aspose forums that point to some kind of memory leak with Aspose slides component and seems to be an old existing problem. In my case too, updating the version only helped to get the memory used, come down from approx 6.5-7 GB to 3.8-4 GB for the same code, But in both cases, they never cleared up the memory post processing.

@ayush.kapoor,

I have observed your comments. I regret to inform that issue is still unresolved. Our product team investigating issue in details and i have requested them to share ETA regarding this issue. I request for your patience until further feedback is shared by them. We will share good news with you soon.

The issues you have found earlier (filed as SLIDESNET-39722) have been fixed in this update.