Click here to get back home

maximum hash/array keys/values

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
maximum hash/array keys/values Slickuser 05-05-2008
Posted by Slickuser on May 5, 2008, 8:04 pm
Please log in for more thread options
What's the maximum hash/array in Perl can hold for keys and values?

Thanks.

Posted by A. Sinan Unur on May 5, 2008, 8:18 pm
Please log in for more thread options
cc630156869f@y18g2000pre.googlegroups.com:

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

Please explain what you mean in a little bit more detail. What do you mean
by maximum hash or maximum array?

Sinan
--
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/

Posted by xhoster on May 5, 2008, 11:22 pm
Please log in for more thread options
> 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.

Posted by Ilya Zakharevich on May 6, 2008, 1:25 am
Please log in for more thread options
[A complimentary Cc of this posting was sent to

> > 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

Similar ThreadsPosted
Data smoothing and getting maximum May 7, 2006, 5:43 am
Maximum number of sockets September 8, 2006, 1:55 pm
maximum size of a hash table February 23, 2005, 8:30 pm
Maximum string length in perl March 16, 2005, 8:22 pm
recursivly checking maximum limit of directory April 18, 2005, 7:06 am
finding maximum element in an array recursively November 30, 2005, 6:40 am
eval EXPR with maximum execution time? February 6, 2008, 3:40 pm
number of maximum decimal places supported with Perl July 22, 2008, 7:17 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap