URL:
  <https://savannah.gnu.org/bugs/?67622>

                 Summary: memory not freed after array unset
                   Group: The GNU Bourne-Again SHell
               Submitter: kunzol
               Submitted: Thu 23 Oct 2025 05:55:38 PM CEST
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 23 Oct 2025 05:55:38 PM CEST By: Kunzol <kunzol>
Hello, 

I just detected, that memory is not freed if a array variable is unset or
overwritten.
String variables do not have this issue. Memory is freed as expected.

To make sure it is in the newest bash version, I cloned the git and compiled
the master branch (5.3).

Steps to reproduce:

$ echo $BASH_VERSION
5.3.3(1)-release
$ ps -o rss -p $$
  RSS
 6616
$ var="$( printf "%s\n" {1..1000000} )"
$ ps -o rss -p $$
  RSS
13288
$ var=""
$ ps -o rss -p $$
  RSS
 6608
$ unset -v var
$ ps -o rss -p $$
  RSS
 6608
$ declare -a avar=( {1..1000000} )
$ ps -o rss -p $$
  RSS
693720
$ declare -a avar=()
$ ps -o rss -p $$
  RSS
693720
$ unset -v avar
$ ps -o rss -p $$
  RSS
693720
$ declare -p avar
bash: declare: avar: not found


Configuration Information:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
uname output: Linux ryzen 6.8.0-64-generic #67~22.04.1-Ubuntu SMP
PREEMPT_DYNAMIC Tue Jun 24 15:19:46 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.3
Patch Level: 3
Release Status: release

Thanks for reading!
Greetings








    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67622>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to