Multiple Dynamic Array
Jarrett Billingsley
kb3ctd2 at yahoo.com
Tue Dec 26 06:37:17 PST 2006
"Bill Baxter" <dnewsgroup at billbaxter.com> wrote in message
news:empvht$9vk$1 at digitaldaemon.com...
> Jarrett, is that equivalent to doing the nested loop allocations above? Or
> does it allocate one contiguous chunk and then set the pointers to point
> inside of that? Just curious, because if you're allocating a huge amount
> of memory that way, then you don't always want it to be contiguous,
> because there may not be a single block of memory available that's big
> enough.
The new int[][][](64, 64, 64) syntax calls _d_newm, which is defined in
dmd/src/phobos/internal/gc/gc.d. It allocates several smaller blocks -- one
for each dimension and for each element, and sets up the pointers/lengths
for you.
More information about the Digitalmars-d-learn
mailing list