libc: Add free_sized() and free_aligned_sized() as per C23

Add C23 sized deallocation entry points as thin wrappers around free(3).
Implementations may ignore size and alignment hints, so behaviour stays
correct for existing allocations without validating caller metadata yet.

When jemalloc is updated to 5.3.1, rewire these to je_free_sized() and
je_free_aligned_sized() so deallocation can use the allocator's sized
deallocation (free_sized for fast paths and free_aligned_sized for
correct aligned hints.)

Please note this change satisfies the standard interface only. Both
functions should be delegated to jemalloc after the upgrade so callers
get the intended allocator behaviour; until then, hints are unused and
neither sized nor aligned-sized deallocation optimizations apply.

Signed-off-by:	Faraz Vahedi <[email protected]>
Reviewed by:	fuz
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2201
MFC after:	1 month
This commit is contained in:
Faraz Vahedi authored and Robert Clausecker committed 2026-06-07 22:59:19 +02:00
1 parent c3f6dcea19
commit 5f732742ad
7 files changed
+175 -1

No files matched your search

+2
View File
@@ -173,6 +173,8 @@ _Noreturn void
*/
#if __ISO_C_VISIBLE >= 2023
size_t memalignment(const void *) __pure2;
void free_sized(void *, size_t) __noexcept;
void free_aligned_sized(void *, size_t, size_t) __noexcept;
#endif /* __ISO_C_VISIBLE >= 2023 */
/*