array limit.

Discussion in 'Perl Misc' started by rajendra, Dec 19, 2006.

  1. rajendra

    rajendra Guest

    Hello All,

    I would like to know if there is any limit on the size of an array in perl.
     
    rajendra, Dec 19, 2006
    #1
    1. Advertising

  2. rajendra wrote:
    > I would like to know if there is any limit on the size of an array in
    > perl.


    Yes. It may not exceed the size of your total memory.

    jue
     
    Jürgen Exner, Dec 19, 2006
    #2
    1. Advertising

  3. rajendra

    Guest

    rajendra wrote:
    > I would like to know if there is any limit on the size of an array in perl.


    No. You are, however, limited by the capabilities of your hardware,
    which vary. Having huge arrays in-memory will cause your performance
    to suffer when you attempt to operate on them.

    If you're thinking about reading a large file into an array, that's
    almost always a bad idea (and absolutely unnecessary).

    --
    David Filmer (http://DavidFilmer.com)
     
    , Dec 19, 2006
    #3
  4. rajendra

    Ric Guest

    rajendra schrieb:
    > Hello All,
    >
    > I would like to know if there is any limit on the size of an array in perl.
    >
    >


    I'm not sure if perl has an internal limit on the array size, but you
    are limited definitely by the max process size of your OS.
    For example you have 3G adressable space for applications on a linux
    32bit os, the rest(1G) is for the kernel. But you cannot practically use
    3G for a single app.

    Then usually there is a syslimit that is much lower then the theoretical
    limit. Some FreeBSD for example have a limit of 512MB per process once
    your perl script hits that barrier it dies.
     
    Ric, Dec 19, 2006
    #4
  5. rajendra

    rajendra Guest

    Hello,
    Thanks for that update.
    If I try to store elements say around 50,000 elements in an array, will
    there be any problem?.


    "Jürgen Exner" <> wrote in message
    news:LgJhh.9563$cx4.633@trndny09...
    > rajendra wrote:
    > > I would like to know if there is any limit on the size of an array in
    > > perl.

    >
    > Yes. It may not exceed the size of your total memory.
    >
    > jue
    >
    >
     
    rajendra, Dec 20, 2006
    #5
  6. rajendra

    Paul Lalli Guest

    rajendra wrote:
    > If I try to store elements say around 50,000 elements in an array, will
    > there be any problem?.


    "What happened when you tried it?"

    The question does not have a definite answer, because it's too general.

    The most important question is - what is an "element"? If each of the
    50,000 elements are single integers, I'd guess probably not. If
    they're each 100Gb blocks of text, I'd guess, yeah, you'll have a
    problem.

    It is also, as has been told to you, dependent on the size of your
    system's memory. There is no hard limit built in to the language.

    Paul Lalli
     
    Paul Lalli, Dec 20, 2006
    #6
    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. Replies:
    5
    Views:
    3,131
  2. Replies:
    1
    Views:
    1,107
    Victor Bazarov
    Jun 28, 2005
  3. D. Susman

    Array Size - Upper Limit

    D. Susman, Dec 18, 2007, in forum: C++
    Replies:
    4
    Views:
    408
    James Kanze
    Dec 19, 2007
  4. Ketchup
    Replies:
    1
    Views:
    263
    Jan Tielens
    May 25, 2004
  5. Drew

    Use array to limit access

    Drew, Mar 19, 2008, in forum: ASP General
    Replies:
    14
    Views:
    413
    Anthony Jones
    Mar 20, 2008
Loading...

Share This Page