4

In Glibc there are 7 bins in fastbin from 0x20 to 0xb0 each bin hold only their size. and it's a one-way linked list.

Does the fastbin in Uclibc(0.9.33.2) is the same ? is there any difference ?

trincot
  • 317,000
  • 35
  • 244
  • 286
python3.789
  • 164
  • 9

1 Answers1

-1

The fastbins of Uclibc are declared in malloc-standard/malloc.h and used in files malloc-standard/mallinfo.c, malloc-standard/malloc.c, malloc-standard/free.c.

The grep utility (when launched on source code of Uclibc) don't find them elsewhere.

A comment in malloc.h says:

/* TRIM_FASTBINS controls whether free() of a very small chunk can
immediately lead to trimming. Setting to true (1) can reduce memory
footprint, but will almost always slow down programs that use a lot
of small chunks.

Define this only if you are willing to give up some speed to more
aggressively reduce system-level memory footprint when releasing
memory in programs that use many small chunks. You can get
essentially the same effect by setting MXFAST to 0, but this can
lead to even greater slowdowns in programs using many small chunks.
TRIM_FASTBINS is an in-between compile-time option, that disables
only those chunks bordering topmost memory from being placed in
fastbins. */ #ifndef TRIM_FASTBINS #define TRIM_FASTBINS 0 #endif

So if you build the Uclibc with TRIM_FASTBINS it seems that the __do_check_remalloced_chunk is handling them like you want.

But I am not sure, you need to compile that Uclibc library from source code and use a debugger to check that property.