By mswatcher
via ericlippert.com
Published: Dec 12 2012 / 08:41
Today I answer the question What’s the deal with the fixed statement? in the form of a dialogue, as is my wont. So: What’s the deal with the fixed statement? As I noted back in 2009, the purpose of the fixed statement is to tell the garbage collector that your code has made an unsafe, unmanaged pointer into a block of managed memory. Since the garbage collector reserves the right to move that memory around, it is important that you inform the garbage collector that it needs to “pin in place” that memory until you tell it otherwise.
Add your comment