Memory footprint of multi-dimensional arrays

BCS BCS at pathlink.com
Fri Apr 18 14:19:16 PDT 2008


Simen Kjaeraas wrote:

> 
> Wouldn't that end up taking just as much space?  b would be an array of
> 10485760 slices, each having a pointer/length pair taking up 8 bytes 
> each,  no?

yup.

> Might save some due to GC wanting bigger slices than 3 bytes, but still.

without going to special types, it's a small as you will get, no extra 
GC overhead in alignment or bookkeeping. (I guess you could allocate the 
whole thing in one go but then you mix pointers and non pointers.)



More information about the Digitalmars-d mailing list