Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 24948: max size of an array ?
- X-seq: zsh-workers 22887
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh <zsh-workers@xxxxxxxxxx>
- Subject: Re: 24948: max size of an array ?
- Date: Thu, 19 Oct 2006 11:33:47 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
Didn't send this to the list, again...
Marc Chantreux <marc.chantreux@xxxxxxxxxxxxxxxxxx> 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@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author