Re: Memory Leak when using Dispose method on object

Hello Adnan,


I’m also having same issue with latest Aspose.Slides.dll v17.3. We are planning to renew the subscription for year 2017, can we expect its fix this year?

It becomes a huge memory leak when we initialize a “Presentation” object with a PPTX file sized 100+ MB, and then that object consumes 300-400MB memory and stays in there until object is re-initialized with a PPTX file with less MBs.

We normally deal with PPTX files sized 300+MB (which contains mp4 video elements in it) and in that case, memory easily shoots up to 600-800MB and then never released. So its a troublesome to deal with memory issue on client/server environment.

Any solution or a quick workaround would be highly appreciated. Thanks.

Hi Azaz ul Haq,

I have observed the issue shared by you. Please note that after end of using(Presentation pres = new …) { … } block or call of Dispose() method, It is not necessary that memory used by .NET process should immediately be freed. The Garbage Collection (GC) doesn’t work like this in terms of SYSTEM MEMORY. It allocates a chunks and can mark it as free during garbage collection, but does not return it back to the system. So, in Process Explorer (Task Manager) or using WorkingSet64 property of process, you will see that memory is used by process. But this doesn’t mean that there is any memory leak existing.

After you work with some presentation and dispose it, load it (or any other presentation) again - multiple times, but every time correctly dispose it via Dispose method or using(Presentation pres = new … ){ … } block, you will never get OutOfMemoryException, because previously allocated memory by .NET memory manager will be correctly freed and re-used again.

Actually, we can’t handle (in general) how .NET manages the process memory as it manages the memory itself on its end. I hope the shared elaboration will be helpful.

Many Thanks,