Maximum array size

jcc7 jcc7_member at pathlink.com
Wed Apr 26 12:10:44 PDT 2006


In article <e2odih$1akv$1 at digitaldaemon.com>, Ivan Kazmenko says...
>
>jcc7:
>>>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."
>Thanks for pointing that out! 

You're quite welcome.

>The document I used is "spec_DMD_0.109.pdf", it's
>outdated and does not seem to contain that limit; where could I find a more
>up-to-date specification? The site docs don't build up to a complete
>specification, do they?

Well, spec_DMD_0.109.pdf is just an unofficial snapshot of the docs that existed
back in December 2004. I might create another PDF sometime, but I think a lot of
pages have been added since I made that PDF (and I'd have to remember how I did
it). But the docs on the digitalmars website and included with DMD are the
official version, so those are the best ones to use anyway (if possible).

There are other PDF snapshots listed at
http://www.prowiki.org/wiki4d/wiki.cgi?LanguageSpecification, but you've already
found the newest one that I know of.

>Still, a question remains: what's the reason for such a limit?

I don't know what the reason is, but I'm sure there is one. It's probably
related to issues such as RAM and garbage collection. It might be there because
it's better to stop this practice at compile time than run the high risk of
running out of memory at runtime. But I'm not expert at memory management, so
I'm just guessing.

jcc7



More information about the Digitalmars-d mailing list