maximum hash/array keys/values

Discussion in 'Perl Misc' started by Slickuser, May 6, 2008.

  1. Slickuser

    Slickuser Guest

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

    Thanks.
    Slickuser, May 6, 2008
    #1
    1. Advertising

  2. Slickuser <> wrote in news:fb5a6ceb-5170-41bb-a278-
    :

    > 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
    --
    A. Sinan Unur <>
    (remove .invalid and reverse each component for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://www.rehabitation.com/clpmisc/
    A. Sinan Unur, May 6, 2008
    #2
    1. Advertising

  3. Slickuser

    Guest

    Slickuser <> wrote:
    > 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.
    , May 6, 2008
    #3
  4. [A complimentary Cc of this posting was sent to

    <>], who wrote in article <20080505232209.204$>:
    > Slickuser <> wrote:
    > > 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
    Ilya Zakharevich, May 6, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rp
    Replies:
    1
    Views:
    497
    red floyd
    Nov 10, 2011
  2. Alex Fenton

    Hash#values and Hash#keys order

    Alex Fenton, Apr 7, 2006, in forum: Ruby
    Replies:
    1
    Views:
    130
    George Ogata
    Apr 15, 2006
  3. Mage

    hash.keys and hash.values

    Mage, Aug 13, 2006, in forum: Ruby
    Replies:
    14
    Views:
    169
  4. Ronald Fischer

    Hash#keys, Hash#values order question

    Ronald Fischer, Aug 23, 2007, in forum: Ruby
    Replies:
    0
    Views:
    145
    Ronald Fischer
    Aug 23, 2007
  5. phanhuyich
    Replies:
    4
    Views:
    256
Loading...

Share This Page