[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Parameter Substitution Causing Memory Leak
From: |
Chet Ramey |
Subject: |
Re: Parameter Substitution Causing Memory Leak |
Date: |
Tue, 07 Jan 2014 14:12:56 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 1/7/14, 2:27 AM, toddbstein@gmail.com wrote:
> Repeat-By:
> These can all be demonstrated by running a script consisting of an
> infinite loop which repeatedly executes any command utilizing any of the
> above examples. Like this:
>
> #!/bin/bash
>
> while :; do
> echo ${variable/pattern}
> done
>
> The resident memory size will continually grow. This occurs on both
> CentOS 6.5 (bash 4.1.2) and Fedora 20 (bash 4.2.45).
Have you run any of these through valgrind? I ran a few, and it did not
report any leaks, at least on bash-4.3-rc1. The increase in memory size is
probably from malloc getting memory from the kernel but not releasing it
back to the kernel after bash calls free (giving memory back to the kernel
is harder than you think).
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/