From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13771 invoked by alias); 10 Apr 2017 04:31:16 -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: 40950 Received: (qmail 2902 invoked from network); 10 Apr 2017 04:31:16 -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 1.334049 secs); 10 Apr 2017 04:31:16 -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 (20) Date: Mon, 10 Apr 2017 06:31:05 +0200 From: Sebastian Gniazdowski To: zsh-workers@zsh.org Message-ID: In-Reply-To: References: Subject: Re: Optimizations, extra memory of (r) flag (the padding) X-Mailer: Airmail (231) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 9 April 2017 at 09:00:00, Sebastian Gniazdowski (psprint=40zdharma.org= ) wrote: > without test-zsh running). So I dropped the test, because saturating 27= 0 MB with array =20 > append without optimizations could take more than a day. That said, why= the extra memory =20 > on current HEAD=3F I bisected this to: 9f8e3e8=C2=A0 =C2=A0 36834: freeheap preserves last allocated heap It was an important optimization that made Zsh fast under heavy memory lo= ads. To see the double-memory usage: % a=3D=24=7B(r:1024*1024*100::=5F:)x=7D % mem() =7B ps -axv =7C grep =24=24 =7D % mem 21525 S =C2=A0 =C2=A0 =C2=A00:06.20 =C2=A0 0 =C2=A0 0 =C2=A0 =C2=A0 =C2=A0= 0 =C2=A02681728 222308 =C2=A0 =C2=A0 - =C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0= 1,3 =C2=A02,7 /usr/local/bin/zsh-5.3.1-dev-0 -i RSS is 8th column. So, instead of 100 MB, there's 200 MB. However, to sho= w that this is heap memory hanging around: % repeat 1; do a=3D=24=7B(r:1024*1024*100::=5F:)x=7D; done % mem 21772 S =C2=A0 =C2=A0 =C2=A00:05.84 =C2=A0 0 =C2=A0 0 =C2=A0 =C2=A0 =C2=A0= 0 =C2=A02579324 119932 =C2=A0 =C2=A0 - =C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0= 2,7 =C2=A01,4 /usr/local/bin/zsh-5.3.1-dev-0 -i Now things are in check =E2=80=93 100 MB (119932) in =60ps=60. I think th= is isn't a big problem, that heap memory can hang around longer, if it bo= osts Zsh speed under high memory loads. -- Sebastian Gniazdowski psprint /at/ zdharma.org