Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » GCHandles   (RSS)

The Truth About GCHandles

I've heard several people asking why GCHandle doesn't implement IDisposable, considering it wraps an unmanaged resource (a handle) and needs to be explicitly freed (using GCHandle.Free()). Before I explain the reason, I want to give a little background
Posted by clyon | 6 Comments
Filed under: ,

GCHandles, Boxing and Heap Corruption

A GCHandle is a struct used to hold onto a managed object to be used by unmanaged code. With a GCHandle you can (among other things): Prevent an object from being garbage collected if unmanaged code has the only live reference to it Pin an object in memory,
Posted by clyon | 9 Comments
Filed under: ,
 
Page view tracker