Chris Lyon's WebLog

Or How I Learned To Stop Worrying And Love The GC

Browse by Tags

Tagged Content List
  • Blog Post: 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 on GCHandles and their dangers. What's a GCHandle...
  • Blog Post: 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, so it won’t be relocated in memory by the garbage...
Page 1 of 1 (2 items)