Request for feedback on WG14 proposal N3849 (alloc_at_least)
Florian Weimer
fweimer@redhat.com
Thu Apr 23 11:19:54 GMT 2026
* Charles Munger:
> https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3849.pdf
>
> I have a proposal for the next C standard to add a new allocator API,
> and I'd like to solicit feedback from glibc's developers to ensure
> it's not going to cause you problems.
The free_sized description is not self-contained, so it's hard to tell
if it's appropriate.
The free_aligned_sized function might not be needed if the caller of
free_sized would have to specify the exact size returned from
aligned_alloc_at_least.
These new functions are not very meaningful with glibc malloc, except
maybe the initial switch from the small string optimization in
std::string to the heap-allocated size, where they could make the full
40 bytes available instead of the requested 31 (with the libstdc++
implementation), avoiding a future resize. Using those extra characters
might avoid further resizing in some cases.
Another potential useful secnario would be aligned_alloc_at_least with a
large alignment, where the tail could be made available for use, but
that seems much less common.
In other cases, it's just about making available very few extra bytes
per allocation. This is not likely to change as glibc malloc evolves.
Thanks,
Florian
More information about the Libc-alpha
mailing list