[PATCH v2 3/3] malloc: limit when to allow to free chunks to tcache

Wilco Dijkstra Wilco.Dijkstra@arm.com
Mon Dec 9 13:53:42 GMT 2024


Hi Cupertino,

>> I don't think changing the _int_free interface makes sense - you can directly
>> call _int_free_chunk from sysmalloc. In principle it makes sense to abstract
>> some of the code needed for this and add an interface for creating internal
>> free chunks. But we shouldn't abuse _int_free for that.
> Very good suggestion indeed. I am still getting used to this recent
> changes in malloc. _int_free_chunk was split from _int_free recently.

Indeed, that improved performance as well as the interfaces.

>> It also makes sense to add an interface for splitting a chunk so that we can improve
>> the implementation. Eg. using a larger MINSIZE or percentage of original size before
>> splitting in order to avoid fragmenting a large chunk into lots of useless tiny ones.
> Well, I guess that would be a very specific splitting for realloc,
> right? Other splits might have to happen unconditionally.

We'd start with using the same split condition in all cases and improve if necessary.
Anyway I'm not expecting your patch to solve this - I'm just pointing out the general
direction of creating new well-defined interfaces.

Also I think it's fine to send this as a separate patch. I don't believe it is a bug in the
current code, but it looks like a general improvement.

Cheers,
Wilco


More information about the Libc-alpha mailing list