Best Practices
Memory Management
.NET Framework Adobe PDF Library SDK
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. As a result, 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 garbage collection happens, a large amount of memory associated with objects no longer in use is freed.
Release unmanaged resources in APDFL as soon as an object is no longer in use, rather than waiting for garbage collection.
To do this, call the Dispose method. In C#, a using statement calls Dispose() automatically:
using (Page page = doc.GetPage(0)) {
// work with page
}