Maximum array size

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Wed Apr 26 10:32:42 PDT 2006


jcc7 wrote:
> 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."

Would it be possible to write the static array part in C and link it
with the rest of the code being D?

-- 
Jari-Matti



More information about the Digitalmars-d mailing list