maximum hash/array keys/values

X

xhoster

Slickuser said:
What's the maximum hash/array in Perl can hold for keys and values?

The maximum will depend on arcane details of your perl build. Almost
certainly your machine will run out of memory long, long before you reach
the internal limit, unless you are doing rather silly. Like this:

perl -le '$x[2**31-2]=8;'

It succeeded, but took 16 gig. 2**31-1 runs out of memory. 2**31 gives an
error of Modification of non-creatable array value attempted, subscript
-2147483648 at -e line 1.

Apparently even 64-bit builds use 32-bit ints for array indices.




Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 
I

Ilya Zakharevich

[A complimentary Cc of this posting was sent to

Slickuser said:
What's the maximum hash/array in Perl can hold for keys and values?

The maximum will depend on arcane details of your perl build. Almost
certainly your machine will run out of memory long, long before you reach
the internal limit, unless you are doing rather silly. Like this:

perl -le '$x[2**31-2]=8;'

It succeeded, but took 16 gig. 2**31-1 runs out of memory. 2**31 gives an
error of Modification of non-creatable array value attempted, subscript
-2147483648 at -e line 1.

Apparently even 64-bit builds use 32-bit ints for array indices.

Maybe. Also, it looks like the code to convert the size of array to
the size of the buffer-with-pointers-to-scalars defaults to 32-bit
integers for some intermediate values.

Could you report it to p5p as a bug?

Thanks,
Ilya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top