From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21800 invoked by alias); 22 May 2017 03:31:48 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41136 Received: (qmail 2264 invoked from network); 22 May 2017 03:31:48 -0000 X-Qmail-Scanner-Diagnostics: from aok120.rev.netart.pl by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(85.128.245.120):SA:0(0.0/5.0):. Processed in 2.135952 secs); 22 May 2017 03:31:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: psprint@zdharma.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at zdharma.org does not designate permitted sender hosts) X-Virus-Scanned: by amavisd-new using ClamAV (8) Date: Mon, 22 May 2017 05:31:37 +0200 From: Sebastian Gniazdowski To: Bart Schaefer , zsh-workers@zsh.org Message-ID: In-Reply-To: <170521164322.ZM5074@torch.brasslantern.com> References: <170521130349.ZM4506@torch.brasslantern.com> <201705212227360937.046E4951@gateway.core.mpy.ch> <170521164322.ZM5074@torch.brasslantern.com> Subject: Re: Re[2]: High memory usage on // substitution in one situation, normal usage in other X-Mailer: Airmail (231) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 22 maja 2017 at 01:43:52, Bart Schaefer (schaefer=40brasslantern.com) = wrote: > Now let's look more closely at the pattern: > =20 > =5B=5E=24'=5C03'-=24'=5C07'=24'=5C013'-=24'=5C014'=24'=5C016'-=24'=5C03= 1'=24'0=5C037'=5D=23=23 > =20 > Look at the rightmost =24'...' expression: =24'0=5C037' > =20 > That has a =220=22 character in it. Probably a typo, but it means that > every time there is a zero digit in =24=5F=5Ftext, 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 =23=23 consumes the entire string). Thanks, I included that fix in my ZUI library, it could hang there very l= ong if not this resolution now. It is still quite interesting why VIRT ra= ises and RES actually drops, below is example htop report: =C2=A0 PID USER =C2=A0 =C2=A0 PRI =C2=A0NI =C2=A0VIRT =C2=A0 RES =C2=A0 S= HR S CPU% MEM% =C2=A0 TIME+ =C2=A0Command 50574 sgniazdo =C2=A031 =C2=A0 0 55.2G 1319M =C2=A0 =C2=A0 0 R 93.0 16.1 = =C2=A00:00.49 zsh-5.3.1-dev-0 -i -- Sebastian Gniazdowski psprint /at/ zdharma.org