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

Free Support Forum - aspose.com

Exception: Out of memory when loading PPT (C# .NET)


one of our customers is having issues with one of their presentations. It is a ~450MB mp4 file. However, this is causing an out of memory exception when we try to load the presentation.

I already researched a bit in the documentation and found out that there are LoadOptions and BlobManagementOptions. But they don´t see to have any affect. If I use the following lines of code my visual studio is showing much higher memory usage and still, an OutOfMemoryException is thrown:

Old code to open presentation:

 var p = new Presentation(path);

image.png (20.9 KB)
image.png (21.2 KB)
image.png (30.1 KB)

New code for loading the pptc:

            using (var stream = new FileStream(path, FileMode.Open))
                var p = new Presentation(stream, new LoadOptions()
                    BlobManagementOptions = new BlobManagementOptions()
                        IsTemporaryFilesAllowed = true,
                        MaxBlobsBytesInMemory = 50 * 1024 * 1024 // 50 MB

image.png (22.6 KB)
image.png (22.0 KB)
image.png (29.3 KB)

So the heap gets even larger using those options and still and OutOfMemoryException thrown even IsTemporaryFilesAllowed is set to true. From the docs:

IsTemporaryFilesAllowed: Set that using of temporary files is not allowed to optimize memory consumption while working with large amounts of data during presentation’s lifetime. If false, OutOfMemoryException can be thrown.

MaxBlobsBytesInMemory A threshold that indicates the maximum amount of bytes which BLOBs can occupied in memory. After this threshold was reached, all new BLOBs will be placed in temporary files and will not affect the total memory consumption of the process. IsTemporaryFilesAllowed should be set to true to use this property.

However I am not allowed to attach the original presentation nor the video file but maybe you can try it yourself with an presentation and some bigger video (~450 MB). Otherwhise I will try rendering an example video later.
I am quite convinced that the video is causing the issue because I can open the pptx without any problems as soon as I remove the single video slide. However there sometimes is a memory peak above the specified 50MB (but not always for some reasons):
image.png (3.0 KB)

Kind Regards,


I have observed the issue shared by you and like to share that you are loading a huge presentation on your end. You need to increase the Java heap size on your end in order to load the huge presentation decks.

Hi @mudassir.fayyaz,

as written in the title I am using Aspose.Slides for .Net, not for Java. As far as I know there is no option in .Net similar to java heap space param. Running on Windows 10 x64 system so a demo console application should be able to allocate enough memory.

Kind Regards,

I guess it might be good if I try to generate an example over the weekend for this


Sure, Please share sample example that replicate issue so that we may further investigate on our end to help you out.

I used an example video which has ~same size as the original from our customer. Example codes, presentation and the video file are uploaded here:


We are trying to download the information shared by you but it is huge and connections get break sometimes. I request you to please verify if the application that you are using is x64 based on x86. When you use x64 based applications in your project settings, you get unlimited memory for program. The x86 based applications generally have restrictions of upto 4GB program memory.


I did some tests with the following results, which confuse me a bit tbh. I initially made the testtool in AnyCPU configuration. However, Visual Studio seems to set a default option to prefer x86 in AnyCPU. If I run in x64 it works good. But in x86 I noticed: The exception also seems to be dependent on the overall ram usage of the system. If I run it directly after rebooting the system I do not get an exception in neither configuration. If my pc was running for a while and some other things like IDE and such are opened and more ram is used by the system the exception is raised. Tbh, I would have expected windows to use its swap file if it really is a problem of physically available ram (I have 8GB installed)…

But still, isn´t it a wrong behaviour of Aspose.Slides to use that much ram with the given LoadOptions and the limitation of MaxBlobsBytesInMemory? The 50MB I have chosen were random but it also did not work with higher values like 300MB as the following screenshot shows:
image.png (33.8 KB)


I have observed your comments and like to share the first part of your observations are related to behavior of Windows and Microsoft Visual Studio IDE. I offered you to use x64 configuration for your project as it gives unlimited program memory where as x86 is restricted upto 3Gb program memory. As far as Aspose.Slides memory consumption is concerned, it need to load the complete Document Object Model (DOM) in memory. So, if there were a 50 MB presentation, it would certainly take much more memory is RAM when loaded using Aspose.Slides as it initialize all the statics and complete data structure of presentation. I hope the shared elaboration will be helpful.

Thanks for your replies. I will check if we will change to a 64 bit application. So there won´t be any changes for x86, is that correct?
Maybe, large address awareness will help, I will check that for us, too…


Yes, as far as Aspose.Slides is concerned there is no issue if you use x86 or x64 based application. You may use x64 based application on your end for more program memory.

A post was split to a new topic: OutOfMemoryException and GDI+ Exceptions Are Thrown in Aspose.Slides 21.11