bash's pattern substitution seems to leak some memory.
Issue
- The customer found that a bash script increases its memory consumption gradually which uses pattern substitution.
- Reproducer
# cat test.sh
a=00:00
while :
do
b=${a/:/}
done
# sh test.sh
- Actual results
# ps aux | grep [t]est.sh
root 21877 78.0 0.1 113900 9084 pts/4 R+ 09:49 0:01 sh test.sh
# ps aux | grep [t]est.sh
root 21877 93.3 0.1 120044 15268 pts/4 R+ 09:49 0:02 sh test.sh
# ps aux | grep [t]est.sh
root 21877 105 0.2 126956 22236 pts/4 R+ 09:49 0:04 sh test.sh
# ps aux | grep [t]est.sh
root 21877 93.3 0.3 133996 29196 pts/4 R+ 09:49 0:05 sh test.sh
^^^^^^^^^^^^
Environment
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
- bash
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.