Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug#245678: zsh: built-in rm -rf fills up the memory
- X-seq: zsh-workers 19895
- From: Clint Adams <clint@xxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Bug#245678: zsh: built-in rm -rf fills up the memory
- Date: Sat, 8 May 2004 10:02:07 -0400
- Cc: 245678-submitter@xxxxxxxxxxxxxxx, zsh-workers@xxxxxxxxxx
- In-reply-to: <20040508043530.GA21396@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20040424162150.GA4210@xxxxxxxxxxxxx> <20040425013647.GA28395@xxxxxxxxxxx> <1040425204530.ZM25792@xxxxxxxxxxxxxxxxxxxxxxx> <20040425211239.GA5011@xxxxxxxxxxx> <1040426171013.ZM26825@xxxxxxxxxxxxxxxxxxxxxxx> <20040508043530.GA21396@xxxxxxxxxxx>
> I think I've found the problem. Here's an excerpt from an strace of
> the zsh/files rm -rf going wild. There are 55 or 56 such calls to mmap
> for every length value. Thus it appears that zsh is allocating
> considerably more memory than it needs.
More on this:
recursivecmd_dorec() calls hrealloc() for each target file, incrementing
size accordingly. hrealloc() rounds the new length up to the nearest
page boundary, and mmaps a new Heap for each file.
So, for example, if you have a directory with one hundred files with
9-byte filenames, zsh might allocate one hundred 4096-byte areas. If
you have several thousand files with 70- to 80-byte filenames, zsh
might allocate over 50 4096-byte areas, over 50 8192-byte areas, and so
on.
Now, should this be fixed by making hrealloc() smarter or
recursivecmd_dorec() more efficient?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author