[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] deallocation of brace expanded variable
From: |
Chet Ramey |
Subject: |
Re: [Help-bash] deallocation of brace expanded variable |
Date: |
Thu, 11 Sep 2014 11:21:26 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
On 9/11/14, 10:49 AM, Sebastian Eiser wrote:
> Dear all,
>
> I'm not sure if this is intended behaviour or not, but it seems that a
> brace expanded variable is not deallocated:
>
> for i in {1..10000000}; do echo -n; done
Here's what I wrote one of the other times this came up:
==========
That's not a memory leak. Malloc implementations need not release
memory back to the kernel; the bash malloc (and others) do so only
under limited circumstances. Memory obtained from the kernel using
mmap or sbrk and kept in a cache by a malloc implementation doesn't
constitute a leak. A leak is memory for which there is no longer a
handle, by the application or by malloc itself.
==========
malloc() is basically a cache between the application and the kernel.
It gets to decide when and how to give memory back to the kernel.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/