In managed / unmanaged compatibility of arrays, I have a case of the absence of the usual
fixed (byte* data = new byte[length]) {
but I want to bind an array where I get the link, for example:
IntPtr dataPtr = camera.Image2d.GetDataBuffer(); fixed (byte* data = (byte *)dataPtr) {
1) In my opinion, the lower code should also work, since "fixed" will set the memory level in the memory manager low and does not care about any objects pointing to it? (Meaning, I don't have a "root" / direct pointer - although there probably is no such thing.)
One more question:
2) The requirement to use "fixed" comes from the CLR memory manager, working simultaneously with any executed code, so it can move arrays at any time?
source share