mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 22:51:50 +03:00
Implement C23's free_sized and free_aligned_sized
[N2699 - Sized Memory Deallocation](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2699.htm) introduced two new functions which were incorporated into the C23 standard, `free_sized` and `free_aligned_sized`. Both already have analogues in Jemalloc, all we are doing here is adding the appropriate wrappers.
This commit is contained in:
parent
41e0b857be
commit
cdb2c0e02f
5 changed files with 75 additions and 1 deletions
|
|
@ -2990,6 +2990,16 @@ je_free(void *ptr) {
|
|||
LOG("core.free.exit", "");
|
||||
}
|
||||
|
||||
JEMALLOC_EXPORT void JEMALLOC_NOTHROW
|
||||
je_free_sized(void *ptr, size_t size) {
|
||||
return je_sdallocx_noflags(ptr, size);
|
||||
}
|
||||
|
||||
JEMALLOC_EXPORT void JEMALLOC_NOTHROW
|
||||
je_free_aligned_sized(void *ptr, size_t alignment, size_t size) {
|
||||
return je_sdallocx(ptr, size, /* flags */ MALLOCX_ALIGN(alignment));
|
||||
}
|
||||
|
||||
/*
|
||||
* End malloc(3)-compatible functions.
|
||||
*/
|
||||
|
|
@ -3153,6 +3163,13 @@ void *__libc_calloc(size_t n, size_t size) PREALIAS(je_calloc);
|
|||
# ifdef JEMALLOC_OVERRIDE___LIBC_FREE
|
||||
void __libc_free(void* ptr) PREALIAS(je_free);
|
||||
# endif
|
||||
# ifdef JEMALLOC_OVERRIDE___LIBC_FREE_SIZED
|
||||
void __libc_free_sized(void* ptr, size_t size) PREALIAS(je_free_sized);
|
||||
# endif
|
||||
# ifdef JEMALLOC_OVERRIDE___LIBC_FREE_ALIGNED_SIZED
|
||||
void __libc_free_aligned_sized(
|
||||
void* ptr, size_t alignment, size_t size) PREALIAS(je_free_aligned_sized);
|
||||
# endif
|
||||
# ifdef JEMALLOC_OVERRIDE___LIBC_MALLOC
|
||||
void *__libc_malloc(size_t size) PREALIAS(je_malloc);
|
||||
# endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue