Hello Adnan,
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,