dump_heap function discrepancy in Glibc

Abhijit Ray Chaudhury abhijit.ray.chaudhury@gmail.com
Thu Jun 13 06:00:56 GMT 2024


Hi Florian,

I understand the formatting issue now. I am using text only formatting,
hope it works.

I am trying to dump heap for better understanding of fragmentation in
glibc. When a new heap is allocated at the bottom (lowest address) there
will be heap_info structure , then there will be malloc_state structure ,
then comes the actual chunk_headers.

I am referencing to the attached picture. Please have a look.

Now my question is around  wheater chunk_header is aligned to
MALLOC_ALIGNMENT or the user pointer which is 2*sizeof(size_t) after
chunk_header starts ,

According to _int_new_arena second one is true. Please refer to
https://elixir.bootlin.com/glibc/glibc-2.39/source/malloc/arena.c#L657.
However dump_heap assumes the first . Please refer to
https://elixir.bootlin.com/glibc/glibc-2.39/source/malloc/arena.c#L343

Please have a look and suggest.

Thanks in advance,
-Abhijit



On Wed, Jun 12, 2024 at 8:24 PM Florian Weimer <fweimer@redhat.com> wrote:

> * Abhijit Ray Chaudhury:
>
> > Thanks a lot Florian. Can you please point me to the function that
> > dumpa heap from 2.34 ?
> >
> > By the way, I see dump_heap is still there in
> > https://elixir.bootlin.com/glibc/latest/source/malloc/malloc.c#L5398 as
> of 2.39 .
> >
> > Please advise.
>
> Sorry, I probably have misunderstood your question.  Your original
> message is apparently readable only in its HTML version, but that was
> stripped by the mailing list.  What we received looked more like this:
>
>   <https://sourceware.org/pipermail/libc-help/2024-June/006682.html>
>
> And it's really hard to make sense of that.  Maybe just copy the
> relevant code from a text editor instead of some website?
>
> Thanks,
> Florian
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Thread Arena (Multiple Heap).png
Type: image/png
Size: 77412 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-help/attachments/20240613/72b43d67/attachment-0001.png>


More information about the Libc-help mailing list