Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Removed arbitrary limitations on array accesses
- X-seq: zsh-workers 27563
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Removed arbitrary limitations on array accesses
- Date: Tue, 05 Jan 2010 07:32:53 -0800
- Cc: Michael Hwang <michael.a.hwang@xxxxxxxxx>
- In-reply-to: <20100105094829.613883ab@news01>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <y> <1262655497-21263-1-git-send-email-michael.a.hwang@xxxxxxxxx> <20100105094829.613883ab@news01>
On Jan 5, 9:48am, Peter Stephenson wrote:
}
} Those have been there for a long time. I don't have any evidence that
} they're doing a lot of good but we have had people creating positional
} parameters with <long_number>=something and wondering why it uses a
} lot of memory. I suppose this is similar. The arbitrary limit is not
} very useful and also undocumented; most people wouldn't miss it if it
} wasn't there, certainly.
I have a vague memory of when this was added, but it appears to have been
sometime longer ago than when the zsh-workers archive begins and after
the last zsh-2 archive I kept -- which means it was late 1994 or early
1995.
My recollection, such as it is, is that attempting to read an array
slice from N to some huge number would allocate a temporary array with
empty slots for all the intervening positions, causing the shell to
crash with an out-of-memory error or to DoS attack the university time-
share system by attempting to consume all memory. The arbitrary 262144
number was chosen based on some computation of the space occupied by
one of those empty slots, to assure that the resulting temporary would
be smaller than the typical VM limitations of a machine of the era.
It seems like we need SOME kind of limit here to prevent the user from
accidentally consuming huge amounts of memory, but it's probably useful
for it to become a computed value based on process limits.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author