Maximum array size

jcc7 jcc7_member at pathlink.com
Wed Apr 26 08:26:38 PDT 2006


In article <e2o1po$hm8$1 at digitaldaemon.com>, Ivan Kazmenko says...
>
>Dave:
>>Instead of
>>
>>T[25_000_000] myarray;
>>
>>just do
>>
>>T[] myarray = new T[25_000_000];
>>
>>and that will take care of the immediate problem you describe and let 
>>you get on with solving the problem.
>Thanks for the verbose reply! I'll check the performance of the suggested
>solution as soon as I get back home.
>
>What I'm concerned of is the performance of the data structure. The simpler, the
>faster, the better. I have a feeling that using a dynamic array adds an extra
>CPU cycle or two since the additional pointer to the data is variable, not
>constant; I'll check that soon. That's why I'm trying to get a working static
>array solution. Languages such as C and D offer a comfortable and readable way
>of writing performance critical parts of the program; it's a shame when it does
>not work afterwards.
>
>Besides, having such an undocumented feature as a 16M limit on an array length
>is IMHO no good and deserves at least an explanation by someone familiar with
>the dmd code.

Are you sure it's undocumented?

See http://www.digitalmars.com/d/arrays.html, "Static Arrays" section

"The total size of a static array cannot exceed 16Mb. A dynamic array should be
used instead for such large arrays."

jcc7



More information about the Digitalmars-d mailing list