array limit.

R

rajendra

Hello All,

I would like to know if there is any limit on the size of an array in perl.
 
J

Jürgen Exner

rajendra said:
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
 
U

usenet

rajendra said:
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).
 
R

Ric

rajendra said:
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.
 
R

rajendra

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

Paul Lalli

rajendra said:
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
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top