[Top][All Lists]

[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 
-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

        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.

        leak() { local arr=("leak"); }
        while :; do leak; done

reply via email to

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