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? A GCHandle is a struct that contains a handle…

6

Brian Talks About SafeHandles

A great post on the BCL Team Blog by Brian Grunkmeyer about SafeHandles. He explains in-depth the topic I brought up ago a few posts ago about mitigating race conditions with the finalizer. Definitely worth a read.