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

Re: zsh segfaults with lots of data in one variable



Richard Hartmann wrote:
> On Tue, Mar 3, 2009 at 23:03, Peter Stephenson
> <p.w.stephenson@xxxxxxxxxxxx> wrote:
> 
> > However, in our case it's easy to fix just using ordindary malloc memory
> > for saving $_. =C2=A0It would be much more efficient to mark underscore as
> > "push old value to stack on write", or something similar, but if I try
> > that at ten o'clock in the evening I'll get it wrong.
> 
> Do you want to revisit this at a later time? If yes, I will mark this as bug
> and put it into SF's bug tracker after some time (usually you are simply too
> fast for me to actually put anything in there ;)

On the whole, I suspect it's not worth it.  The shell is optimised for
moving around strings of a few dozen bytes or so.  To do it better, we'd
need some sort of a stack; that means an additional allocation.  That's
going to add to the complexity in the vast majority of cases just to
improve the occasional case where $_ is some huge string on entry to a
function.   I don't regard this as a bug, anyway, so I think we can
ignore it for now.

Ta.

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



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