Memory Management

Adobe PDF Library .NET

Adobe PDF Library (APDFL) .NET objects can be associated with a large amount of unmanaged memory which exerts little memory pressure on the .NET runtime. Therefore, there could be a long period before the garbage collector deletes these objects because it is not aware of the size of the unmanaged or native objects in APDFL.  

Once the garbage collection happens, a large amount of memory associated with objects no longer in use is freed. It is important then to release the unmanaged resources in APDFL as soon as an object is no longer in use.   

To do this, call the Dispose method. 

In C#, a using statement automatically calls Dispose():  

  using (Page page = doc.GetPage(0)) {  

   }