Buckets:
arudradey/ml-cpu-storage / emsdk /upstream /emscripten /system /lib /mimalloc /src /alloc-override.c
| /* ---------------------------------------------------------------------------- | |
| Copyright (c) 2018-2026, Microsoft Research, Daan Leijen | |
| This is free software; you can redistribute it and/or modify it under the | |
| terms of the MIT license. A copy of the license can be found in the file | |
| "LICENSE" at the root of this distribution. | |
| -----------------------------------------------------------------------------*/ | |
| mi_decl_externc void vfree(void* p); | |
| mi_decl_externc size_t malloc_size(const void* p); | |
| mi_decl_externc size_t malloc_good_size(size_t size); | |
| // helper definition for C override of C++ new | |
| typedef void* mi_nothrow_t; | |
| // ------------------------------------------------------ | |
| // Override system malloc | |
| // ------------------------------------------------------ | |
| // gcc, clang: use aliasing to alias the exported function to one of our `mi_` functions | |
| // XXX EMSCRIPTEN: Add "weak" | |
| // otherwise use forwarding by calling our `mi_` function | |
| // define MI_OSX_IS_INTERPOSED as we should not provide forwarding definitions for | |
| // functions that are interposed (or the interposing does not work) | |
| mi_decl_externc size_t mi_malloc_size_checked(void *p) { | |
| if (!mi_is_in_heap_region(p)) return 0; | |
| return mi_usable_size(p); | |
| } | |
| // use interposing so `DYLD_INSERT_LIBRARIES` works without `DYLD_FORCE_FLAT_NAMESPACE=1` | |
| // See: <https://books.google.com/books?id=K8vUkpOXhN4C&pg=PA73> | |
| struct mi_interpose_s { | |
| const void* replacement; | |
| const void* target; | |
| }; | |
| MI_INTERPOSE_DECLS(_mi_interposes) = | |
| { | |
| MI_INTERPOSE_MI(malloc), | |
| MI_INTERPOSE_MI(calloc), | |
| MI_INTERPOSE_MI(realloc), | |
| MI_INTERPOSE_MI(strdup), | |
| MI_INTERPOSE_MI(realpath), | |
| MI_INTERPOSE_MI(posix_memalign), | |
| MI_INTERPOSE_MI(reallocf), | |
| MI_INTERPOSE_MI(valloc), | |
| MI_INTERPOSE_FUN(malloc_size,mi_malloc_size_checked), | |
| MI_INTERPOSE_MI(malloc_good_size), | |
| // we interpose malloc_default_zone in alloc-override-osx.c so we can use mi_free safely | |
| MI_INTERPOSE_MI(free), | |
| MI_INTERPOSE_FUN(vfree,mi_free), | |
| // sometimes code allocates from default zone but deallocates using plain free :-( (like NxHashResizeToCapacity <https://github.com/nneonneo/osx-10.9-opensource/blob/master/objc4-551.1/runtime/hashtable2.mm>) | |
| MI_INTERPOSE_FUN(free,mi_cfree), // use safe free that checks if pointers are from us | |
| MI_INTERPOSE_FUN(vfree,mi_cfree), | |
| }; | |
| MI_INTERPOSE_DECLS(_mi_interposes_10_7) = { MI_INTERPOSE_MI(strndup) }; | |
| MI_INTERPOSE_DECLS(_mi_interposes_10_15) = { MI_INTERPOSE_MI(aligned_alloc) }; | |
| extern "C" { | |
| void _ZdlPv(void* p); // delete | |
| void _ZdaPv(void* p); // delete[] | |
| void _ZdlPvm(void* p, size_t n); // delete | |
| void _ZdaPvm(void* p, size_t n); // delete[] | |
| void* _Znwm(size_t n); // new | |
| void* _Znam(size_t n); // new[] | |
| void* _ZnwmRKSt9nothrow_t(size_t n, mi_nothrow_t tag); // new nothrow | |
| void* _ZnamRKSt9nothrow_t(size_t n, mi_nothrow_t tag); // new[] nothrow | |
| } | |
| __attribute__((used)) static struct mi_interpose_s _mi_cxx_interposes[] __attribute__((section("__DATA, __interpose"))) = | |
| { | |
| MI_INTERPOSE_FUN(_ZdlPv,mi_free), | |
| MI_INTERPOSE_FUN(_ZdaPv,mi_free), | |
| MI_INTERPOSE_FUN(_ZdlPvm,mi_free_size), | |
| MI_INTERPOSE_FUN(_ZdaPvm,mi_free_size), | |
| MI_INTERPOSE_FUN(_Znwm,mi_new), | |
| MI_INTERPOSE_FUN(_Znam,mi_new), | |
| MI_INTERPOSE_FUN(_ZnwmRKSt9nothrow_t,mi_new_nothrow), | |
| MI_INTERPOSE_FUN(_ZnamRKSt9nothrow_t,mi_new_nothrow), | |
| }; | |
| _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRT_HYBRIDPATCHABLE | |
| void* __cdecl _expand(_Pre_notnull_ void* _Block, _In_ _CRT_GUARDOVERFLOW size_t _Size) { | |
| return mi_expand(_Block, _Size); | |
| } | |
| _Check_return_ _ACRTIMP | |
| size_t __cdecl _msize_base(_Pre_notnull_ void* _Block) _CRT_NOEXCEPT { | |
| return mi_malloc_size(_Block); | |
| } | |
| _Check_return_ _ACRTIMP _CRT_HYBRIDPATCHABLE | |
| size_t __cdecl _msize(_Pre_notnull_ void* _Block) { | |
| return mi_malloc_size(_Block); | |
| } | |
| _ACRTIMP | |
| void __cdecl _free_base(_Pre_maybenull_ _Post_invalid_ void* _Block) { | |
| mi_free(_Block); | |
| } | |
| _ACRTIMP _CRT_HYBRIDPATCHABLE | |
| void __cdecl free(_Pre_maybenull_ _Post_invalid_ void* _Block) { | |
| mi_free(_Block); | |
| } | |
| _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRT_JIT_INTRINSIC _CRTRESTRICT _CRT_HYBRIDPATCHABLE | |
| void* __cdecl malloc(_In_ _CRT_GUARDOVERFLOW size_t _Size) { | |
| return mi_malloc(_Size); | |
| } | |
| _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _malloc_base(_In_ size_t _Size) { | |
| return mi_malloc(_Size); | |
| } | |
| _Success_(return != 0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _realloc_base(_Pre_maybenull_ _Post_invalid_ void* _Block, _In_ size_t _Size) { | |
| return mi_realloc(_Block, _Size); | |
| } | |
| _Success_(return != 0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT _CRT_HYBRIDPATCHABLE | |
| void* __cdecl realloc(_Pre_maybenull_ _Post_invalid_ void* _Block, _In_ _CRT_GUARDOVERFLOW size_t _Size) { | |
| return mi_realloc(_Block, _Size); | |
| } | |
| _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Count * _Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _calloc_base(_In_ size_t _Count, _In_ size_t _Size) { | |
| return mi_calloc(_Count, _Size); | |
| } | |
| _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Count * _Size) _ACRTIMP _CRT_JIT_INTRINSIC _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl calloc(_In_ _CRT_GUARDOVERFLOW size_t _Count, _In_ _CRT_GUARDOVERFLOW size_t _Size) { | |
| return mi_calloc(_Count, _Size); | |
| } | |
| _Success_(return != 0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Count * _Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _recalloc_base(_Pre_maybenull_ _Post_invalid_ void* _Block, _In_ size_t _Count, _In_ size_t _Size) { | |
| return mi_recalloc(_Block, _Count, _Size); | |
| } | |
| _Success_(return != 0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Count * _Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _recalloc(_Pre_maybenull_ _Post_invalid_ void* _Block, _In_ _CRT_GUARDOVERFLOW size_t _Count, _In_ _CRT_GUARDOVERFLOW size_t _Size) { | |
| return mi_recalloc(_Block, _Count, _Size); | |
| } | |
| _ACRTIMP | |
| void __cdecl _aligned_free(_Pre_maybenull_ _Post_invalid_ void* _Block) { | |
| mi_free(_Block); | |
| } | |
| _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _aligned_malloc(_In_ _CRT_GUARDOVERFLOW size_t _Size, _In_ size_t _Alignment) { | |
| return mi_malloc_aligned(_Size, _Alignment); | |
| } | |
| _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _aligned_offset_malloc(_In_ _CRT_GUARDOVERFLOW size_t _Size, _In_ size_t _Alignment, _In_ size_t _Offset) { | |
| return mi_malloc_aligned_at(_Size, _Alignment, _Offset); | |
| } | |
| _Check_return_ _ACRTIMP | |
| size_t __cdecl _aligned_msize(_Pre_notnull_ void* _Block, _In_ size_t _Alignment, _In_ size_t _Offset) { | |
| MI_UNUSED(_Alignment); MI_UNUSED(_Offset); return mi_malloc_size(_Block); | |
| } | |
| _Success_(return != 0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _aligned_offset_realloc(_Pre_maybenull_ _Post_invalid_ void* _Block, _In_ _CRT_GUARDOVERFLOW size_t _Size, _In_ size_t _Alignment, _In_ size_t _Offset) { | |
| return mi_realloc_aligned_at(_Block, _Size, _Alignment, _Offset); | |
| } | |
| _Success_(return != 0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Count * _Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _aligned_offset_recalloc(_Pre_maybenull_ _Post_invalid_ void* _Block, _In_ _CRT_GUARDOVERFLOW size_t _Count, _In_ _CRT_GUARDOVERFLOW size_t _Size, _In_ size_t _Alignment, _In_ size_t _Offset) { | |
| return mi_recalloc_aligned_at(_Block, _Count, _Size, _Alignment, _Offset); | |
| } | |
| _Success_(return != 0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _aligned_realloc(_Pre_maybenull_ _Post_invalid_ void* _Block, _In_ _CRT_GUARDOVERFLOW size_t _Size, _In_ size_t _Alignment) { | |
| return mi_realloc_aligned(_Block, _Size, _Alignment); | |
| } | |
| _Success_(return != 0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Count * _Size) _ACRTIMP _CRTALLOCATOR _CRTRESTRICT | |
| void* __cdecl _aligned_recalloc(_Pre_maybenull_ _Post_invalid_ void* _Block, _In_ _CRT_GUARDOVERFLOW size_t _Count, _In_ _CRT_GUARDOVERFLOW size_t _Size, _In_ size_t _Alignment) { | |
| return mi_recalloc_aligned(_Block, _Count, _Size, _Alignment); | |
| } | |
| // On all other systems forward allocation primitives to our API | |
| mi_decl_export void* malloc(size_t size) MI_FORWARD1(mi_malloc, size) | |
| mi_decl_export void* calloc(size_t size, size_t n) MI_FORWARD2(mi_calloc, size, n) | |
| mi_decl_export void* realloc(void* p, size_t newsize) MI_FORWARD2(mi_realloc, p, newsize) | |
| mi_decl_export void free(void* p) MI_FORWARD0(mi_free, p) | |
| // In principle we do not need to forward `strdup`/`strndup` but on some systems these do not use `malloc` internally (but a more primitive call) | |
| // We only override if `strdup` is not a macro (as on some older libc's, see issue #885) | |
| mi_decl_export char* strdup(const char* str) MI_FORWARD1(mi_strdup, str) | |
| mi_decl_export char* strndup(const char* str, size_t n) MI_FORWARD2(mi_strndup, str, n) | |
| // ------------------------------------------------------ | |
| // Override new/delete | |
| // This is not really necessary as they usually call | |
| // malloc/free anyway, but it improves performance. | |
| // ------------------------------------------------------ | |
| // ------------------------------------------------------ | |
| // With a C++ compiler we override the new/delete operators. | |
| // see <https://en.cppreference.com/w/cpp/memory/new/operator_new> | |
| // ------------------------------------------------------ | |
| void operator delete(void* p) noexcept MI_FORWARD0(mi_free,p) | |
| void operator delete[](void* p) noexcept MI_FORWARD0(mi_free,p) | |
| void* operator new(std::size_t n) noexcept(false) MI_FORWARD1(mi_new,n) | |
| void* operator new[](std::size_t n) noexcept(false) MI_FORWARD1(mi_new,n) | |
| void* operator new (std::size_t n, const std::nothrow_t& tag) noexcept { MI_UNUSED(tag); return mi_new_nothrow(n); } | |
| void* operator new[](std::size_t n, const std::nothrow_t& tag) noexcept { MI_UNUSED(tag); return mi_new_nothrow(n); } | |
| void operator delete (void* p, std::size_t n) noexcept MI_FORWARD02(mi_free_size,p,n) | |
| void operator delete[](void* p, std::size_t n) noexcept MI_FORWARD02(mi_free_size,p,n) | |
| void operator delete (void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); } | |
| void operator delete[](void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); } | |
| void operator delete (void* p, std::size_t n, std::align_val_t al) noexcept { mi_free_size_aligned(p, n, static_cast<size_t>(al)); }; | |
| void operator delete[](void* p, std::size_t n, std::align_val_t al) noexcept { mi_free_size_aligned(p, n, static_cast<size_t>(al)); }; | |
| void operator delete (void* p, std::align_val_t al, const std::nothrow_t&) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); } | |
| void operator delete[](void* p, std::align_val_t al, const std::nothrow_t&) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); } | |
| void* operator new( std::size_t n, std::align_val_t al) noexcept(false) { return mi_new_aligned(n, static_cast<size_t>(al)); } | |
| void* operator new[]( std::size_t n, std::align_val_t al) noexcept(false) { return mi_new_aligned(n, static_cast<size_t>(al)); } | |
| void* operator new (std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast<size_t>(al)); } | |
| void* operator new[](std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast<size_t>(al)); } | |
| // ------------------------------------------------------ | |
| // Override by defining the mangled C++ names of the operators (as | |
| // used by GCC and CLang). | |
| // See <https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling> | |
| // ------------------------------------------------------ | |
| void _ZdlPv(void* p) MI_FORWARD0(mi_free,p) // delete | |
| void _ZdaPv(void* p) MI_FORWARD0(mi_free,p) // delete[] | |
| void _ZdlPvm(void* p, size_t n) MI_FORWARD02(mi_free_size,p,n) | |
| void _ZdaPvm(void* p, size_t n) MI_FORWARD02(mi_free_size,p,n) | |
| void _ZdlPvSt11align_val_t(void* p, size_t al) { mi_free_aligned(p,al); } | |
| void _ZdaPvSt11align_val_t(void* p, size_t al) { mi_free_aligned(p,al); } | |
| void _ZdlPvmSt11align_val_t(void* p, size_t n, size_t al) { mi_free_size_aligned(p,n,al); } | |
| void _ZdaPvmSt11align_val_t(void* p, size_t n, size_t al) { mi_free_size_aligned(p,n,al); } | |
| void _ZdlPvRKSt9nothrow_t(void* p, mi_nothrow_t tag) { MI_UNUSED(tag); mi_free(p); } // operator delete(void*, std::nothrow_t const&) | |
| void _ZdaPvRKSt9nothrow_t(void* p, mi_nothrow_t tag) { MI_UNUSED(tag); mi_free(p); } // operator delete[](void*, std::nothrow_t const&) | |
| void _ZdlPvSt11align_val_tRKSt9nothrow_t(void* p, size_t al, mi_nothrow_t tag) { MI_UNUSED(tag); mi_free_aligned(p,al); } // operator delete(void*, std::align_val_t, std::nothrow_t const&) | |
| void _ZdaPvSt11align_val_tRKSt9nothrow_t(void* p, size_t al, mi_nothrow_t tag) { MI_UNUSED(tag); mi_free_aligned(p,al); } // operator delete[](void*, std::align_val_t, std::nothrow_t const&) | |
| void* _Znwm(size_t n) MI_FORWARD1(mi_new,n) // new 64-bit | |
| void* _Znam(size_t n) MI_FORWARD1(mi_new,n) // new[] 64-bit | |
| void* _ZnwmRKSt9nothrow_t(size_t n, mi_nothrow_t tag) { MI_UNUSED(tag); return mi_new_nothrow(n); } | |
| void* _ZnamRKSt9nothrow_t(size_t n, mi_nothrow_t tag) { MI_UNUSED(tag); return mi_new_nothrow(n); } | |
| void* _ZnwmSt11align_val_t(size_t n, size_t al) MI_FORWARD2(mi_new_aligned, n, al) | |
| void* _ZnamSt11align_val_t(size_t n, size_t al) MI_FORWARD2(mi_new_aligned, n, al) | |
| void* _ZnwmSt11align_val_tRKSt9nothrow_t(size_t n, size_t al, mi_nothrow_t tag) { MI_UNUSED(tag); return mi_new_aligned_nothrow(n,al); } | |
| void* _ZnamSt11align_val_tRKSt9nothrow_t(size_t n, size_t al, mi_nothrow_t tag) { MI_UNUSED(tag); return mi_new_aligned_nothrow(n,al); } | |
| void* _Znwj(size_t n) MI_FORWARD1(mi_new,n) // new 64-bit | |
| void* _Znaj(size_t n) MI_FORWARD1(mi_new,n) // new[] 64-bit | |
| void* _ZnwjRKSt9nothrow_t(size_t n, mi_nothrow_t tag) { MI_UNUSED(tag); return mi_new_nothrow(n); } | |
| void* _ZnajRKSt9nothrow_t(size_t n, mi_nothrow_t tag) { MI_UNUSED(tag); return mi_new_nothrow(n); } | |
| void* _ZnwjSt11align_val_t(size_t n, size_t al) MI_FORWARD2(mi_new_aligned, n, al) | |
| void* _ZnajSt11align_val_t(size_t n, size_t al) MI_FORWARD2(mi_new_aligned, n, al) | |
| void* _ZnwjSt11align_val_tRKSt9nothrow_t(size_t n, size_t al, mi_nothrow_t tag) { MI_UNUSED(tag); return mi_new_aligned_nothrow(n,al); } | |
| void* _ZnajSt11align_val_tRKSt9nothrow_t(size_t n, size_t al, mi_nothrow_t tag) { MI_UNUSED(tag); return mi_new_aligned_nothrow(n,al); } | |
| // ------------------------------------------------------ | |
| // Further Posix & Unix functions definitions | |
| // ------------------------------------------------------ | |
| extern "C" { | |
| // Forward Posix/Unix calls as well | |
| void* reallocf(void* p, size_t newsize) MI_FORWARD2(mi_reallocf,p,newsize) | |
| size_t malloc_size(const void* p) MI_FORWARD1(mi_usable_size,p) | |
| size_t malloc_usable_size(void *p) MI_FORWARD1(mi_usable_size,p) | |
| size_t malloc_usable_size(const void *p) MI_FORWARD1(mi_usable_size,p) | |
| // No forwarding here due to aliasing/name mangling issues | |
| mi_decl_weak // XXX EMSCRIPTEN | |
| void* valloc(size_t size) { return mi_valloc(size); } | |
| void vfree(void* p) { mi_free(p); } | |
| size_t malloc_good_size(size_t size) { return mi_malloc_good_size(size); } | |
| mi_decl_weak // XXX EMSCRIPTEN | |
| int posix_memalign(void** p, size_t alignment, size_t size) { return mi_posix_memalign(p, alignment, size); } | |
| // `aligned_alloc` is only available when __USE_ISOC11 is defined. | |
| // Note: it seems __USE_ISOC11 is not defined in musl (and perhaps other libc's) so we only check | |
| // for it if using glibc. | |
| // Note: Conda has a custom glibc where `aligned_alloc` is declared `static inline` and we cannot | |
| // override it, but both _ISOC11_SOURCE and __USE_ISOC11 are undefined in Conda GCC7 or GCC9. | |
| // Fortunately, in the case where `aligned_alloc` is declared as `static inline` it | |
| // uses internally `memalign`, `posix_memalign`, or `_aligned_malloc` so we can avoid overriding it ourselves. | |
| mi_decl_weak // XXX EMSCRIPTEN | |
| void* aligned_alloc(size_t alignment, size_t size) { return mi_aligned_alloc(alignment, size); } | |
| // no forwarding here due to aliasing/name mangling issues | |
| void cfree(void* p) { mi_free(p); } | |
| void* pvalloc(size_t size) { return mi_pvalloc(size); } | |
| mi_decl_weak // XXX EMSCRIPTEN | |
| void* memalign(size_t alignment, size_t size) { return mi_memalign(alignment, size); } | |
| void* _aligned_malloc(size_t size, size_t alignment) { return mi_malloc_aligned(size,alignment); } | |
| mi_decl_weak // XXX EMSCRIPTEN | |
| void* reallocarray(void* p, size_t count, size_t size) { return mi_reallocarray(p, count, size); } | |
| // some systems define reallocarr so mark it as a weak symbol (#751) | |
| mi_decl_weak int reallocarr(void* p, size_t count, size_t size) { return mi_reallocarr(p, count, size); } | |
| // forward __libc interface (see PR #667) | |
| void* __libc_malloc(size_t size) MI_FORWARD1(mi_malloc, size) | |
| void* __libc_calloc(size_t count, size_t size) MI_FORWARD2(mi_calloc, count, size) | |
| void* __libc_realloc(void* p, size_t size) MI_FORWARD2(mi_realloc, p, size) | |
| void __libc_free(void* p) MI_FORWARD0(mi_free, p) | |
| mi_decl_weak // XXX EMSCRIPTEN | |
| void* __libc_memalign(size_t alignment, size_t size) { return mi_memalign(alignment, size); } | |
| void* emscripten_builtin_malloc(size_t size) MI_FORWARD1(mi_malloc, size) | |
| void* emscripten_builtin_realloc(void* p, size_t size) MI_FORWARD2(mi_realloc, p, size) | |
| void* emscripten_builtin_free(void* p) MI_FORWARD0(mi_free, p) | |
| void* emscripten_builtin_memalign(size_t alignment, size_t size) { return mi_memalign(alignment, size); } | |
| void* emscripten_builtin_calloc(size_t nmemb, size_t size) MI_FORWARD2(mi_calloc, nmemb, size) | |
| // forward __libc interface (needed for glibc-based and musl-based Linux distributions) | |
| void* __libc_malloc(size_t size) MI_FORWARD1(mi_malloc,size) | |
| void* __libc_calloc(size_t count, size_t size) MI_FORWARD2(mi_calloc,count,size) | |
| void* __libc_realloc(void* p, size_t size) MI_FORWARD2(mi_realloc,p,size) | |
| void __libc_free(void* p) MI_FORWARD0(mi_free,p) | |
| void __libc_cfree(void* p) MI_FORWARD0(mi_free,p) | |
| void* __libc_valloc(size_t size) { return mi_valloc(size); } | |
| void* __libc_pvalloc(size_t size) { return mi_pvalloc(size); } | |
| void* __libc_memalign(size_t alignment, size_t size) { return mi_memalign(alignment,size); } | |
| int __posix_memalign(void** p, size_t alignment, size_t size) { return mi_posix_memalign(p,alignment,size); } | |
| } | |
Xet Storage Details
- Size:
- 23.1 kB
- Xet hash:
- 3f0007f383bb836fb411edea387fbc4c7e584e1843f96b470dea7f02fb7ae87e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.