zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Cc: 245678-forwarded@bugs.debian.org
Subject: Re: Bug#245678: zsh: built-in rm -rf fills up the memory
Date: Sun, 25 Apr 2004 20:45:30 +0000	[thread overview]
Message-ID: <1040425204530.ZM25792@candle.brasslantern.com> (raw)
In-Reply-To: <20040425013647.GA28395@scowler.net>

On Apr 24,  9:36pm, Clint Adams wrote:
}
} I can reproduce the memory consumption with a 7210-file Maildir, except
} that my kernel does the right thing and kills the runaway zsh.
} 
} If I abort the rm before it OOMs, zsh will continue to take up a large
} amount of memory until it exits.

There's got to be something here you're not telling us.  Either there is
an alias for "rm", or a function named "rm", or the zsh/files module is
loaded; otherwise "rm" and "/bin/rm" should be equivalent (assuming there
is no other "rm" in the path) and in any case shouldn't execute inside
the shell.

Assuming that it's the zsh/files module, the interesting thing there is
that, because it's a depth-first traversal, it allocates zsh-heap memory
to store all the file names in the directory, and it does so by growing
the allocated heap block once for each filename, by the length of that
filename (plus one).  If ZSH_MEM was not defined at compile time, doing
this efficiently is left up to the underlying malloc() implementation [if
I'm reading mem.c correctly] and therefore could be subject to bugs we've
seen before where malloc never reclaims nor consolidates blocks when the
implementation repeatedly realloc()s in slightly larger chunks.

I don't know anything about how zsh is compiled on debian or even why
the zsh/files module would be used (seemingly) by default, but in that's
probably the place to start looking.


  reply	other threads:[~2004-04-25 20:45 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 [this message]
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
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=1040425204530.ZM25792@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=245678-forwarded@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).