Two-dimensional array in memory [duplicate]
Asked Answered
K

1

2

Possible Duplicate:
Array memory allocation - paging

Does byte[,] myArray is always in continuous memory block?

I have some code which works with images stored in such arrays, everything works fine, but I just ask for sure.

EDIT: I work with unsafe code.

Kush answered 20/7, 2012 at 8:35 Comment(1)
Take a look at this answer. There is a reference that: "In C# you can't guarantee that the memory block will be contiguous. The CLR tries to allocate the memory in one contiguous block, but it may allocate it in several blocks..."Passementerie
T
1

Yes, it's always there, in memory and will be memorized consecutively.

take a look : True Unsafe Code Performance

And msdn says you can use without think about it: http://msdn.microsoft.com/en-us/library/28k1s2k6%28v=vs.80%29.aspx

Tablecloth answered 20/7, 2012 at 8:36 Comment(2)
and, "Use pointers like anyone do not use." The best solution ever to faster things up ;)Tablecloth
https://mcmap.net/q/73802/-differences-between-a-multidimensional-array-quot-quot-and-an-array-of-arrays-quot-quot-in-cKush

© 2022 - 2024 — McMap. All rights reserved.