Bug 1245233
| Summary: | bash script shows memory leak | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Martin Kyral <mkyral> | 
| Component: | bash | Assignee: | Ondrej Oprala <ooprala> | 
| Status: | CLOSED NEXTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | 
| Severity: | medium | Docs Contact: | |
| Priority: | high | ||
| Version: | 22 | CC: | admiller, ooprala, ovasik | 
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | 4.3.42-1.fc21 | Doc Type: | Bug Fix | 
| Doc Text: | Story Points: | --- | |
| Clone Of: | 126161 | Environment: | |
| Last Closed: | 2015-08-05 22:25:06 UTC | Type: | --- | 
| Regression: | --- | Mount Type: | --- | 
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| bash-4.3.39-6.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/bash-4.3.39-6.fc21 bash-4.3.39-6.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/bash-4.3.39-6.fc22 bash-4.3.39-6.fc23 has been submitted as an update for Fedora 23. https://admin.fedoraproject.org/updates/bash-4.3.39-6.fc23 Package bash-4.3.39-6.fc23: * should fix your issue, * was pushed to the Fedora 23 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing bash-4.3.39-6.fc23' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-12688/bash-4.3.39-6.fc23 then log in and leave karma (feedback). bash-4.3.39-6.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report. bash-4.3.39-6.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report. bash-4.3.42-1.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/bash-4.3.42-1.fc21 bash-4.3.42-1.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/bash-4.3.42-1.fc22 bash-4.3.42-1.fc23 has been submitted as an update for Fedora 23. https://admin.fedoraproject.org/updates/bash-4.3.42-1.fc23 bash-4.3.42-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report. bash-4.3.42-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report. bash-4.3.42-1.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report. | 
This ancient bug has been reintroduced in fedora: $ cat loop.sh #!/bin/bash run() { local -a A=(); local -a A=(); } while :; do run; done $ cat test2.sh #!/bin/bash $(readlink /proc/$$/exe) loop.sh & SHPID=$! sleep 1 MEM=$(ps p $SHPID o "%z" | grep -v VSZ) echo "memory consumption: $MEM" sleep 15 MEM2=$(ps p $SHPID o "%z" | grep -v VSZ) kill $SHPID echo "memory consumption: $MEM2" #compare memory consumption [ $MEM -eq $MEM2 ] $ bash test2.sh memory consumption: 130292 memory consumption: 373304 $ In both RHEL6 and RHEL7 the test passes. Version: bash-4.3.39-3.fc22 +++ This bug was initially created as a clone of Bug #126161 +++ [root@localhost root]# bash --version GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu) Copyright (C) 2002 Free Software Foundation, Inc. For testing purposes he uses: --------------- #!/bin/bash run() { local -a A=(); local -a A=(); } while :; do run; done --------------- This routine is eating up memory, which shows clearly in 'cat /proc/meminfo' or 'top'. --- Additional comment from Bernd Schmidt on 2004-06-16 17:31:58 EDT --- When make_local_variable finds an existing variable with the same name, it is reused. However, we never call array_dispose to free array data. This patch adds centralized freeing of all data for a reused local variable.