bug-bash
[Top][All Lists]
Advanced

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

Parameter Substitution Causing Memory Leak


From: toddbstein
Subject: Parameter Substitution Causing Memory Leak
Date: Mon, 6 Jan 2014 23:27:35 -0800

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS 
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin'  -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong 
--param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic
uname output: Linux tibs6 3.12.5-302.fc20.x86_64 #1 SMP Tue Dec 17 20:42:32 UTC 
2013 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.2
Patch Level: 45
Release Status: release

Description:
        The following forms of parameter substitution all seem to leak memory:
                ${variable/pattern}
                ${variable/pattern/string}
                ${variable//pattern}
                ${variable//pattern/string}
                ${variable#pattern}
                ${variable##pattern}
                ${variable%pattern}
                ${variable%%pattern}

        Other forms (like ${variable:0:1} and ${#variable}, for example) do not 
leak memory.


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).



reply via email to

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