|
From: | Chet Ramey |
Subject: | Re: bash memory leak when querying associative array for nonexisting element |
Date: | Mon, 21 Nov 2022 15:36:32 -0500 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
On 11/20/22 8:02 AM, Ralf Oehler wrote:
Bash Version: 5.2 Patch Level: 2 Release Status: release Description: I want to read an associative array. Like so: y="${aa[$i]}" If aa contains the element queried, then everything works as expected If aa does not contain such an element, the result is the empty string, which is expected, but the query permanently increases the memory consumption of the executing bash, which is not expected. The program below demonstrates this behaviour. When run, the bash process increases its memory indefinitely. I did not find a fix.
Thanks for the report. Koichi's fix is a good one. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
[Prev in Thread] | Current Thread | [Next in Thread] |