From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Cc: 245678-submitter@bugs.debian.org
Subject: Re: Bug#245678: zsh: built-in rm -rf fills up the memory
Date: Mon, 10 May 2004 09:51:53 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.44.0405100937380.30973-100000@toltec.zanshin.com> (raw)
In-Reply-To: <28310.1084205953@csr.com>
On Mon, 10 May 2004, Peter Stephenson wrote:
> This is all ghastly even by zsh standards.
Well, that's what comes of having glued MMAP into the hrealloc() algorithm
piecemeal. Probably what should have been done was just to #ifdef the
entire function body.
> What we should do is the equivalent of realloc as an #else of the code
> above --- mmap a larger chunk, unmap the old one, and return the new
> one.
I think I said that, though I hadn't got so far as to pinpoint where it
needed to happen.
> However, I don't think even *that* is the basic problem. I think this:
>
> old = (old + H_ISIZE - 1) & ~(H_ISIZE - 1);
> new = (new + H_ISIZE - 1) & ~(H_ISIZE - 1);
>
> is wrong --- it should be the heap size here, not H_ISIZE which is
> simply sizeof(union mem_align), which is probably only 4 or 8 words.
It took me a while staring at this to decide that it was doing the right
thing, but I came to the conclusion that it's only actually _wrong_ if
HEAP_ARENA_SIZE is _not_ a multiple of H_ISIZE. And even then I'm pretty
sure "wrong" just means "inefficient".
> We only need to reallocate to heap size boundaries
That's correct, but we _do_ only reallocate to heap size boundaries in the
non-MMAP case. I think. It's only the MMAP'd code, which as I said was
pasted in long after the original algorithm was written, that botches it.
> I might be tempted by proposed solutions involving the complete removal
> of hrealloc.
Which would mean what, exactly? Never grow heap blocks?
(Note that I didn't begin with "why".)
next prev parent reply other threads:[~2004-05-10 16:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040424162150.GA4210@ay.vinc17.org>
2004-04-25 1:36 ` Clint Adams
2004-04-25 20:45 ` Bart Schaefer
2004-04-25 21:12 ` Clint Adams
2004-04-25 21:38 ` Clint Adams
2004-04-26 17:10 ` Bart Schaefer
2004-05-08 4:35 ` Clint Adams
2004-05-08 14:02 ` Clint Adams
2004-05-08 14:13 ` Clint Adams
2004-05-09 22:54 ` Bart Schaefer
2004-05-09 22:48 ` Bart Schaefer
2004-05-09 23:30 ` Clint Adams
2004-05-09 23:36 ` Clint Adams
2004-05-09 23:51 ` Bart Schaefer
2004-05-10 10:16 ` Peter Stephenson
2004-05-10 14:09 ` Clint Adams
2004-05-10 15:54 ` Bart Schaefer
2004-05-10 16:19 ` Peter Stephenson
2004-05-10 16:51 ` Bart Schaefer [this message]
2004-05-10 17:23 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0405100937380.30973-100000@toltec.zanshin.com \
--to=schaefer@brasslantern.com \
--cc=245678-submitter@bugs.debian.org \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).