bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String replacements leak small amounts of memory each time


From: Chet Ramey
Subject: Re: String replacements leak small amounts of memory each time
Date: Mon, 14 Jun 2010 22:23:59 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1

On 6/14/10 5:25 PM, Øyvind Hvidsten wrote:
> It would seem Debian Squeeze uses that option as default.
> Without it, I get a whole ton of warnings, and errors about "free",
> "malloc" and "realloc" being defines multiple times.
> 
> Have you tried to reproduce the problem outside of Valgrind? Just
> running the examples and looking at the memory usage? I've tried on two
> different machines now, with bash 4.1.5 and 3.2.25, and it happens on
> both, though it does seem to happen a lot faster on 4.1.5. Other people
> in #bash have reproduced it too.
> 
> By the way it seems one of my slashes were removed at some point. The
> testcases need to be run in the / directory, or the command has to be:
> while read line; do test=${line#\ }; done < <(ls -lR /)
> ..in order to generate enough input to reproduce the issue.

There's no evidence that bash frees a lot of memory when the program
ends (valgrind would report that, too), nor that it makes a lot of
allocations that are not quickly followed by frees.  You may have hit
on an allocation pattern that the system malloc handles badly, or it
might be the case that there is a memory leak that I can't detect with
the tools I have.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]