zsh-users
 help / color / mirror / code / Atom feed
* 24948: max size of an array ?
@ 2006-10-19  7:19 Marc Chantreux
  2006-10-19 10:35 ` Phil Pennock
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Chantreux @ 2006-10-19  7:19 UTC (permalink / raw)
  To: zsh-users

Hi all,

I noticed that the max size of an array is 24948. Is it right ? Is there 
  a way to work around ?

regards
mc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 24948: max size of an array ?
  2006-10-19  7:19 24948: max size of an array ? Marc Chantreux
@ 2006-10-19 10:35 ` Phil Pennock
  2006-10-19 15:20   ` Marc Chantreux
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Pennock @ 2006-10-19 10:35 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 24948: max size of an array ?
  2006-10-19 10:35 ` Phil Pennock
@ 2006-10-19 15:20   ` Marc Chantreux
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Chantreux @ 2006-10-19 15:20 UTC (permalink / raw)
  To: zsh-users

Phil Pennock wrote:

> Are you sure ... on your OS?

sure :

users=($( my cmd ))
echo $#users
24948
# 67123 users in fact

i've splitted the result in two arrays (alphabeticaly) and ly script 
works fine now.

> Is this the limit you're hitting?

i fill an array with the stdout of a command. So the limit can't be out 
of zsh imho. Peter's explaination sounds good for me. I'll inspect that 
asap.

regards
mc


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-19 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-19  7:19 24948: max size of an array ? Marc Chantreux
2006-10-19 10:35 ` Phil Pennock
2006-10-19 15:20   ` Marc Chantreux

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).