Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Re[2]: High memory usage on // substitution in one situation, normal usage in other
On 22 maja 2017 at 01:43:52, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> Now let's look more closely at the pattern:
>
> [^$'\03'-$'\07'$'\013'-$'\014'$'\016'-$'\031'$'0\037']##
>
> Look at the rightmost $'...' expression: $'0\037'
>
> That has a "0" character in it. Probably a typo, but it means that
> every time there is a zero digit in $__text, the // recursion has to
> save state before proceeding. This doesn't happen when the text is
> nothng but underscores. The state that is being saved includes the
> entire tail of the string from that point onward, so in the first
> example it requires approximately 1.8MB/2*(the number of zeroes in
> all integers from 1 to 200000), and in the second case it never does
> recur (the ## consumes the entire string).
Thanks, I included that fix in my ZUI library, it could hang there very long if not this resolution now. It is still quite interesting why VIRT raises and RES actually drops, below is example htop report:
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
50574 sgniazdo 31 0 55.2G 1319M 0 R 93.0 16.1 0:00.49 zsh-5.3.1-dev-0 -i
--
Sebastian Gniazdowski
psprint /at/ zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author