Shawn A. Van Ness wrote: > Ok, so I grant that GC.KeepAlive(this) does have some effect. But > what does this have to do with IntPtr fields?
The (somewhat dubious) assumption is that an IntPtr represents an unmanaged resource. > I mean, is there something special about IntPtr (like, maybe the > reads/writes aren't atomic on all 64-bit processor architectures?) No nothing special, IntPtr writes are guaranteed to be atomic. > can the rule be extended to include any field that represents the > identity of an unmanaged resource, regardless of what type or how wide > it is Exactly. > -- is the rule simply intended to prevent double-free bugs? Not exactly. It's about preventing a handle-recycling attack. See http://blogs.msdn.com/cbrumme/archive/2003/04/19/51365.aspx Regards, Jeroen =================================== This list is hosted by DevelopMentorŪ http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com