I want to pin an array of bytes which is 10 megabytes long so that managed and unmanaged code can work on it.
My scenario is that I have an unmanaged driver which reads some data from the device and writes it to the big array and the managed application just reads that data.
Something like this:
byte[] dataArray = new byte[10*1024*1024];
I want to pin dataArray so that GC does not move it.
What happens actually when I just run the application, I get a DataAbortApplication, and after reading on the internet I found out that I should pin the dataArray
to avoid this error.
How/what should I do?
fixed
statement msdn.microsoft.com/en-us/library/f58wzh21.aspx