What should I pin when working on arrays?
I'm trying to write a DynamicMethod to wrap the cpblk IL opcode . I need to copy chunks of byte arrays and on x64 platforms, this is supposedly the fastest way to do it. Array.Copy and Buffer.BlockCopy both work, but I'd like to explore all options. My goal is to copy managed memory from one byte array to a new managed byte array. My concern is how do I know how to correctly "pin" memory location. I don't want the garbage collector to move the arrays and break everything. SO far it works but I'm not sure how to test if this is GC safe. // copying 'count' bytes from offset 'index' in 'source'