From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 650 invoked by alias); 19 Oct 2015 17:21:24 -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: 36896 Received: (qmail 27839 invoked from network); 19 Oct 2015 17:21:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=2Oqr3UnNVJophbGEW8xY/CBqaMoHdWL4RVhKjyynrSQ=; b=DQUzC7YO6sz+7F3UqreOT46xGSBq0CXK/POIu1tSIdKX8WXQcjC3GI59Q8d1Jl5o8j Xc2qdzlw9SPnG9SrACIfNgDdGmeYjr8gmNKJgxLk08N5rp66Tqi8tc3NadXq3fIUELdp qTxuMU4wcifKwY5hpnY+9dkK5OKFBuP/w3NFNQx7vgah4PmbPuPJqyxenjEQgY5W1glq mVVPs+ua91VspO7rkba/dBiNDV6JDw8it/KctMCJgtfv9Sv9W4ZFt/rp1k2VzLoSbPwD ilSbRyR1EB56oaD5hpVOOd3hYeDhOvq104ouuzPRr4Du6EGgtn4ncSCBgEfqMjcXoMdi +e7A== X-Gm-Message-State: ALoCoQnX3VoYSwRwQx2H/aXIGtim2WmLEgDKwUU4wQ4WXW1HcwxuWY+R92dwToyxJ6z7+3V3KVRc X-Received: by 10.202.62.139 with SMTP id l133mr2278708oia.0.1445275280499; Mon, 19 Oct 2015 10:21:20 -0700 (PDT) From: Bart Schaefer Message-Id: <151019102117.ZM32700@torch.brasslantern.com> Date: Mon, 19 Oct 2015 10:21:17 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: Slowdown around 5.0.5-dev-0" (Oct 18, 11:31pm) References: <151010105849.ZM10144@torch.brasslantern.com> <151010170623.ZM16166@torch.brasslantern.com> <151010232045.ZM12931@torch.brasslantern.com> <151011091757.ZM27755@torch.brasslantern.com> <151011103121.ZM8814@torch.brasslantern.com> <151011142204.ZM9103@torch.brasslantern.com> <151012070105.ZM15099@torch.brasslantern.com> <151012173304.ZM15477@torch.brasslantern.com> <151013085246.ZM30504@torch.brasslantern.com> <20151014142722.282d0c5a@pwslap01u.europe.root.pri> <151014092536.ZM32511@torch.brasslantern.com> <151014095009.ZM19954@torch.brasslantern.com> <151014213224.ZM15646@torch.brasslantern.com> <151015173554.ZM30733@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Slowdown around 5.0.5-dev-0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 18, 11:31pm, Sebastian Gniazdowski wrote: } } > String is stored as one contiguous block of bytes, so each time it exceeds } > the size of the current heap block an entire new large-enough block is } > allocated, and no previous block can never be re-used because the string } > never shrinks. } } How can 5.1.1-dev-0 with no patches maintain low memory usage for } strings then? It's probably this: + h->next = NULL; + } else { + /* Leave an empty arena at the end until popped */ + h->used = 0; + fheap = hl = h; + break; + } + if (fheap == h) We leave that empty arena at the end, but then on the next zhalloc() it's still not big enough, so another one gets allocated. You could try removing that "else" to let the trailing block be freed again, but then we're back to needing to compare speed as well as space across shell versions.