This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Add malloc micro benchmark

Ondřej Bílka wrote:
>> I think a heap-style allocator which does not segregate allocations
>> of different sizes still has its place, and why not provide one in
>> glibc?
> That isn't case for any allocator and it is asking for trouble. You want
> to avoid sitation where two big chunks couldn't be merged because of
> tiny chunk between them.

Agreed, you always want to special case small blocks. I don't believe there is
any advantage in using a single big heap.

> For larger size this representation is still problematic and you could
> improve performance with another representation that also avoids
> alignment problem by placing metadata elsewhere(for mine only 4 bytes are needed).

Larger sizes would be helped a lot once small blocks are dealt with separately.
So I don't think we need complicated balanced binary trees when dealing with a
small number of large blocks. You won't need an unsorted list either, large blocks
can be merged in O(1) time.

There may be an advantage to place meta data elsewhere, for example it could make
adding/removing/walking free lists much faster (spatial locality) or to make heap
overflow attacks almost impossible,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]