Re: Max size of an array used in perl.
- From: Joe Smith <joe@xxxxxxxxx>
- Date: Tue, 30 Jan 2007 13:21:43 -0800
rajendra wrote:
Hello All,
I would like to know the max size that an array can store in terms of bytes.
As much as your memory system allows.
WinXP% uname -a
CYGWIN_NT-5.1 wiggin 1.5.23(0.156/4/2) 2006-12-19 10:52 i686 Cygwin
WinXP% perl -le '$,=$a=",";for(;;){print time()-$^T,$b++, length $a; $a.=$a}'
0,0,1
0,1,2
0,2,4
0,3,8
0,4,16
0,5,32
0,6,64
0,7,128
0,8,256
0,9,512
0,10,1024
0,11,2048
0,12,4096
0,13,8192
0,14,16384
0,15,32768
0,16,65536
0,17,131072
0,18,262144
0,19,524288
0,20,1048576
0,21,2097152
0,22,4194304
0,23,8388608
0,24,16777216
0,25,33554432
1,26,67108864
1,27,134217728
1,28,268435456
2,29,536870912
Out of memory!
There it took 2 seconds to go from 256M to 512M
On an 800 MHz P-III with 256M RAM:
0,25,33554432
0,26,67108864
1,27,134217728
2,28,268435456
21,29,536870912
155,30,1073741824
panic: realloc at -e line 1.
That is 21 seconds to double after exceeding physical memory and
155 seconds to double after that. After 1GB, it used up all the
available swap space on that poor little machine.
I haven't tried that test on a 16GB machine where perl is compiled with use64bitall.
-Joe
.
- References:
- Max size of an array used in perl.
- From: rajendra
- Max size of an array used in perl.
- Prev by Date: FAQ 3.2 How can I use Perl interactively?
- Next by Date: Re: Tar on Windows XP
- Previous by thread: Re: Max size of an array used in perl.
- Next by thread: Regex repeating capture
- Index(es):