OutOfMemoryException when Importing PPTX Files and Extracting Objects as SVG in C#

Hi Aspose folks!

We’re having a memory problem while using Aspose .NET packages to import PowerPoint presentations and extract SVGs from them in a web app. More exactly, after doing it a few times, the container runs out of memory and the .NET platform throws OutOfMemoryException().

The problem reproduces mostly on Linux containers, and we highly suspect that it is caused by the internal static caches maintained by Aspose packages. In order to fix it, we kindly ask you to:

  • Please provide us with a list of ALL Aspose API calls that we need to call in order to insure ALL internal caches are emptied (or at least adjusted to the amount of memory available in the container).

  • If there are some internal caches that cannot be emptied this way, then we would need you to also provide (in the near future) some API calls for emptying them, too.

Thanks a lot!
PwC.

@ottap,
Thank you for contacting support.

Please try to set a limit on memory consumption when loading the presentation files like this:

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

using (var presentation = new Presentation("example.pptx", loadOptions))
{
    // ...
}

Documents: Load a Large Presentation as BLOB
API Reference: IBlobManagementOptions interface

@andrey.potapov,

Thanks a lot for your reply! What is the lowest value that can be assigned to MaxBlobsBytesInMemory? Can we set it to zero?

In case this won’t have the desired effect, we may still need a way to empty internal static caches. The scenario is like this: after loading a few presentations and exporting objects as SVGs, the app runs out of memory (though we do dispose all disposable objects). So any chance this will be possible in the future (clearing all caches on demand)?

We’ll try your suggestion first.

Thanks again!
PwC.

@ottap,

You can set the MaxBlobsBytesInMemory property to zero, but in any case, some minimum amount of memory will be used. It depends on the content of the presentation. Actually, this property is used for large media content (images, video, audio).

Unfortunately, there is no such feature. We need a sample project, presentation files, and environment description to investigate the case and help you properly.