Hacker News new | ask | show | jobs
by jabl 1311 days ago
> I don't fully understand the need or benefit of having free_sized() available tbh.

It's a performance optimization. Allocator implementations spend quite a lot of time in free() matching the provided pointer to the correct size bucket (as to why they don't have something like a ptr->bucket hash table, IDK, maybe it would consume too much memory overhead particularly for small allocations?). With free_sized() this step can be jumped over.

1 comments

Thanks for your insights, which prompted to actually jump into the malloc.c implementation.