I have the following code to allocate buffer
uns16 m_rawBuffer = new uns16[m_rawBufferSize];
pin_ptr<uns16> ptrAcqBuffer = m_rawBuffer;
Although it is pin_ptr from time to time GC modifies ptrAcqBuffer.
From the document I see
A pinning pointer is an interior pointer that prevents the object pointed to from moving on the garbage-collected heap. That is, the value of a pinning pointer is not changed by the common language runtime. This is required when you pass the address of a managed class to an unmanaged function so that the address will not change unexpectedly during resolution of the unmanaged function call.
It doesn't make sesnse to me... Can someone please explain ? Also because I created m_rawBuffer with "new" do I need to "pin_ptr" ?
Thanks.