List Info

Thread: Limitation of Array




Limitation of Array
country flaguser name
United States
2008-03-06 01:01:26

How many elements can be stored in an array? I mean, is there any
maximum limit for an array? If anybody knows, please answer.

Thanks in advance
Vijay

__._,_.___
.

__,_._,___
Re: Limitation of Array
country flaguser name
United States
2008-03-06 02:00:10

>>&gt;>> "Vijaya" == Vijaya Kumar < mp_vijayakumar%40yahoo.com">mp_vijayakumaryahoo.com> writes:

Vijaya&gt; How many elements can be stored in an array? I mean, is there any
Vijaya&gt; maximum limit for an array? If anybody knows, please answer.

Perl imposes no limits, but it's certainly limited to whatever fits into the
addressing space of a process on your system, because data is all
memory-resident.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<; merlyn%40stonehenge.com">merlynstonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

__._,_.___
.

__,_._,___
Re: Limitation of Array
country flaguser name
United States
2008-03-06 09:13:34

>>&gt;>> "Jenda" == Jenda Krynicky < Jenda%40Krynicky.cz">JendaKrynicky.cz> writes:

Jenda>; From: merlyn%40stonehenge.com">merlynstonehenge.com
&gt;> >>&gt;>> "Vijaya" == Vijaya Kumar < mp_vijayakumar%40yahoo.com">mp_vijayakumaryahoo.com> writes:
>>
Vijaya&gt; How many elements can be stored in an array? I mean, is there any
Vijaya&gt; maximum limit for an array? If anybody knows, please answer.
>>
>>; Perl imposes no limits, but it's certainly limited to whatever fits into the
>> addressing space of a process on your system, because data is all
>> memory-resident.

Jenda> I kinda doubt it. The index of an array is an integer so I'd expect
Jenda&gt; the maximum limit to be your size of integers.

Jenda> Which means
Jenda> use Config;
Jenda> $maxint = 2 ** ($Config{intsize}*8 - 1);

Jenda> The limit looks way big enough so I doubt Perl bothers to check
Jenda&gt; whether it needs to promote to something bigger as the array grows.

But I believe the standard "integer" size is always supposed to exceed the
number of addressable bytes for a given architecture. Given that each Perl
Scalar is some number (16?) bytes at a minimum, you already lose a few bits
worth of the number of possible scalars, so I think you're in the clear.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<; merlyn%40stonehenge.com">merlynstonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )