mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 11:54:38 +01:00
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
22 lines
345 B
C
22 lines
345 B
C
/*
|
|
* Copyright (c) 2026 Faraz Vahedi <[email protected]>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <sys/cdefs.h>
|
|
#include <stdlib.h>
|
|
|
|
void __free(void *);
|
|
|
|
void
|
|
__free_aligned_sized(void *ptr, size_t alignment, size_t size)
|
|
{
|
|
|
|
(void)alignment;
|
|
(void)size;
|
|
__free(ptr);
|
|
}
|
|
|
|
__weak_reference(__free_aligned_sized, free_aligned_sized);
|