Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 24948: max size of an array ?



On 2006-10-19 at 09:19 +0200, Marc Chantreux wrote:
> I noticed that the max size of an array is 24948. Is it right ? Is there 
>  a way to work around ?

Are you sure that this is the limit of a zsh array and not the limit of
what can be passed in argv, given the size of your arguments, to a
command via the execve() system call on your OS?

% typeset -a mille; mille=()
% for ((i=0; i < 100; i+=1)) mille+=($i{0,1,2,3,4,5,6,7,8,9})
% print $#mille
1000
% typeset -a foo; foo=(); for ((i=0; i < 30; i+=1)) foo+=(${i}${mille})
% print $#foo
30000

On my OS, I can use print and /bin/echo just fine with that; if I repeat
the foo loop 100 times, so that $#foo is 100000, then I can use the zsh
print builtin but if I try to use /bin/echo I get:
zsh: argument list too long: /bin/echo

Is this the limit you're hitting?

Regards,
-Phil



Messages sorted by: Reverse Date, Date, Thread, Author