bug-bash
[Top][All Lists]
Advanced

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

Memory leak in function with local array


From: Thomas.Grenman
Subject: Memory leak in function with local array
Date: Sun, 2 May 2021 15:19:19 +0300

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -flto=auto -ffat-lto-objects -fexceptions -g 
-grecord-gcc-switches -pipe -Wall -Werror=format-security 
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic 
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
uname output: Linux localhost 5.11.16-300.fc34.x86_64 #1 SMP Wed Apr 21 
13:18:33 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 5.1
Patch Level: 4
Release Status: release

Description:
        There seems to be a memory leak in bash when a local array is declared 
within a function.
        I also tested this on "GNU bash, version 5.0.17(1)-release 
(x86_64-redhat-linux-gnu)" and that one works without any leaks.

Repeat-By:
        #!/bin/bash
        leak() { local arr=("leak"); }
        while :; do leak; done



reply via email to

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