Hi,
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);
Results:
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
}
});
}
Results:
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,
Daniel