Question about freeing segments in non contiguous main_arena
Abhijit Ray Chaudhury
abhijit.ray.chaudhury@gmail.com
Mon May 4 12:29:01 GMT 2026
Hi Florian,
Thanks a lot for your reply. When an application starts freeing memory and
frees all the memory for one mmaped segment , where av->top currently
points to , how av->top be adjusted ?
My assumption is that if all the memory is freed by the application that
belongs to main_arena , av->top should go back to the contiguous [heap]
segment . This question pertains to the non-contiguous main_arena scenario .
Please let me know your thoughts on this.
Thanks in advance,
-Abhijit
On Mon, May 4, 2026 at 5:22 PM Florian Weimer <fweimer@redhat.com> wrote:
> * Abhijit Ray Chaudhury via Libc-help:
>
> > When main_arena can not grow using brk , mmap is used to fall back and
> > main_atrena is marked non-contiguous.
> >
> > My question is how the VM associated with mmped segments of main_arena
> are
> > freed when a full segment is free through buffer coalescence ?
>
> I don't think code for this exists today. The address space is never
> freed. Memory can be freed if the application calls malloc_trim.
>
> Thanks,
> Florian
>
>
More information about the Libc-help
mailing list