Associative Arrays max length? 32bit/64bit
sdvcn via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 17 02:41:48 PDT 2014
On Saturday, 17 May 2014 at 09:26:32 UTC, Marc Schütz wrote:
> On Saturday, 17 May 2014 at 00:25:13 UTC, sdvcn wrote:
>> import std.stdio;
>>
>> import std.utf;
>> import std.uni;
>> import std.string;
>> import std.random;
>> import std.conv;
>>
>> int main(string[] argv)
>> {
>>
>> size_t[string] bary;
>>
>> try{
>> for(size_t i=0;i<(size_t.max -1);i++)
>> {
>> bary["Key:" ~ to!(string)(i)] = i;
>> }
>> }catch(Exception e)
>> {
>> writeln(e);
>> }
>> return 0;
>> }
>> // This code will overflow?
>>
>>
>> bary.length <> size_t.max ?
>>
>> 32bit bary.length == 64bit bary.length ?
>
> I cannot get the 32bit version to run on my computer, but what
> exactly is happening?
>
> I suspect you will simply run out of memory at some point, but
> this shouldn't be caught by catch(Exception), as it should
> throw an Error.
>
> Can you post the exact output of your program?
Does not capture.
My computer is 16g memory, amd x2 250 cpu ,windows 2008 r2
int main(string[] argv)
{
size_t[string] bary;
for(size_t i=0;i<(size_t.max -1);i++)
{
bary["Key:" ~ to!(string)(i)] = i;
}
return 0;
}
-m32 results are "ngram.exe 中的 0x7547c42d (KernelBase.dll)
处有未经处理的异常: 0xE0440001: 0xe0440001"
-m64 Overflow
I do not know bary.length results,
Want to know the maximum capacity of the Associative Arrays
32bit? 64bit?
Why will overflow? How to capture? How to Avoid?
More information about the Digitalmars-d
mailing list