zsh-workers
 help / color / mirror / code / Atom feed
* Re: 24948: max size of an array ?
@ 2006-10-19 10:33 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2006-10-19 10:33 UTC (permalink / raw)
  To: zsh

Didn't send this to the list, again...

Marc Chantreux <marc.chantreux@ulpmm.u-strasbg.fr> wrote:
> I noticed that the max size of an array is 24948. Is it right ? Is there 
>   a way to work around ?

The number in the code currently says 262144, but yes, there's a limit.

I'm not at all sure it's right.  It was added as an entirely arbitrary
limit to prevent people crashing the shell by assigning to large array
elements, with no correlation to the actual amount of memory available.
The correct fix would be for the shell to fail gracefully when it couldn't
allocate memory, but that's quite tricky to handle in all circumstances.
Second-guessing user behaviour with a fixed limit is somewhat fraught.

It would be fairly straightforward to make the limit configurable via a
parameter such as ZSH_MAX_ARRLEN.  This would have to be a special
parameter for efficiency (we test this quite a lot deep in the
parameter code).

I suppose then we'd have people complaining they set ZSH_MAX_ARRLEN to
several zillion and then the shell crashed when they tried to allocate an
array.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-19 10:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-19 10:33 24948: max size of an array ? Peter Stephenson

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).