This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: free() does not physically trim/reclaim memory
- From: shuxin yang <shuxinyang dot oss at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>, libc-help at sourceware dot org
- Date: Fri, 2 Sep 2016 09:27:41 -0700
- Subject: Re: free() does not physically trim/reclaim memory
- Authentication-results: sourceware.org; auth=none
- References: <57C8724B.3020707@gmail.com> <3354ddf3-60fd-1e80-d0ca-7036b8d487d4@redhat.com>
Hi, Florian:
On 09/02/2016 04:44 AM, Florian Weimer wrote:
On 09/01/2016 08:24 PM, shuxin yang wrote:
In my application, I need to call mmap() a block right after BSS in
order to prevent heap from growing.
You cannot rely that this has any observable effect. Why do you need
to do this?
Our application embeds luajit. Due to some limitations, luajit
allocates object under 2G;
on x86-64 platform, it is done by calling mmap() with flag MAP_32BIT and
then cutting
a block out of it. We need to preserve the space (BSS-end, 2G] for
luajit. That is why
we need to mmap() a tiny block right after BSS right before the main()
function of the application
is entered.
Thanks
Shuxin
Thanks,
Florian