1

Topic: How many occupies storages an array int32

Kind day all! We admit there is an array int32 in the size n. How many it will physically occupy storages (without titles) in 64-digit process (the machine and wasps  too)? The size int32 - 4, 4*n byte, that is on the physical size of an element? Or the physical size of the slot under an array cell will be aligned to 64 (8) and  the general size will be 8*n byte?

2

Re: How many occupies storages an array int32

Hello, MadHuman, you wrote: MH> the size int32 - 4, 4*n byte, that is on the physical size of an element? Yes, on the physical size. It is checked elementarily: using System; class Program {unsafe static void Main (string [] args) {var array = new int [10]; for (var i = 0; i <array. Length; (i) {array [i] = i;} fixed (int* ptr = array) {byte* p = (byte *) ptr; for (var i = 0; i <array. Length; (i) {Console. WriteLine (* ((int *) p)); p + = 4;}}}}

3

Re: How many occupies storages an array int32

Hello, hardcase, you wrote: H> Hello, MadHuman, you wrote: MH>> the size int32 - 4, 4*n byte, that is on the physical size of an element? H> yes, on the physical size. It is checked elementarily: yes, thanks. And when then alignment happens? Only for object/structure fields? Or still there are variants?

4

Re: How many occupies storages an array int32

Hello, MadHuman, you wrote: MH> yes, thanks. And when then alignment happens? MH> only for object/structure fields? Or still there are variants? With alignment of fields of object and objects in an array all is uneasy. Can differ for different  (Mono/Dotnet) or for different versions : https://www.youtube.com/watch?v=XGtieBVI1lk

5

Re: How many occupies storages an array int32

Hello, MadHuman, you wrote: Buffer. ByteLength