title: C# deallocate memory referenced by IntPtr
body: <p>I am using some unmanaged code that is returning pointers (IntPtr) to large image objects.  I use the references but after I am finished with the images, I need to free that memory referenced by the pointers.  Currently, the only thing that frees the memory is to shutdown my entire app.  I need to be able to free that memory from inside my application.</p>
  
  <p>Here is the call to that allocates the memory.  <code>hbitmap</code> is the pointer that is returned and needs to be deallocated.</p>
  
  <pre><code>[DllImport("twain_32.dll", EntryPoint = "#1")]
  public static extern TwainResult DsImageTransfer(
      [In, Out] Identity origin, [In] Identity dest, DataGroup dg, 
      DataArgumentType dat, Message msg, ref IntPtr hbitmap);
  </code></pre>