Question about freeing segments in non contiguous main_arena
Florian Weimer
fweimer@redhat.com
Wed May 6 10:04:39 GMT 2026
* Abhijit Ray Chaudhury:
> Hi Florian,
>
> Thanks a lot for your reply. In the case of non-contiguous main_arena
> , assume the av->top points to a mmapped segment. Application started
> freeing the memory in the order of allocation . av->top starts getting
> adjusted . Since it is not heap_info structure you don't know the
> base address of the segment. Would munmap be called ?
>
> If it is not called, would we leak the virtual address space ? How is
> the address space supported to be reclaimed ? Is it a bug then ?
This code path is mostly unused. A mapping that acts as an obstraction
for sbrk is required. Currently, MTE-enabled malloc on Arm uses this
code path, too.
We have a similar problems with heaps in the middle of arenas. Tackling
that is probably more worthwhile.
Thanks,
Florian
More information about the Libc-help
mailing list