mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 15:29:31 +03:00
Merge branch 'dev' into dev-slice
This commit is contained in:
commit
18c1891708
3 changed files with 15 additions and 4 deletions
|
@ -25,6 +25,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
void operator delete(void* p) noexcept { mi_free(p); };
|
void operator delete(void* p) noexcept { mi_free(p); };
|
||||||
void operator delete[](void* p) noexcept { mi_free(p); };
|
void operator delete[](void* p) noexcept { mi_free(p); };
|
||||||
|
|
||||||
|
void operator delete (void* p, const std::nothrow_t&) noexcept { mi_free(p); }
|
||||||
|
void operator delete[](void* p, const std::nothrow_t&) noexcept { mi_free(p); }
|
||||||
|
|
||||||
void* operator new(std::size_t n) noexcept(false) { return mi_new(n); }
|
void* operator new(std::size_t n) noexcept(false) { return mi_new(n); }
|
||||||
void* operator new[](std::size_t n) noexcept(false) { return mi_new(n); }
|
void* operator new[](std::size_t n) noexcept(false) { return mi_new(n); }
|
||||||
|
|
||||||
|
@ -41,9 +44,11 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
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::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& tag) 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 delete[](void* p, std::align_val_t al, const std::nothrow_t& tag) 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) 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)); }
|
||||||
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)); }
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#if defined(MI_MALLOC_OVERRIDE) && !(defined(_WIN32))
|
#if defined(MI_MALLOC_OVERRIDE) && !(defined(_WIN32))
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
mi_decl_externc void vfree(void* p);
|
mi_decl_externc void vfree(void* p);
|
||||||
mi_decl_externc size_t malloc_size(const void* p);
|
mi_decl_externc size_t malloc_size(const void* p);
|
||||||
mi_decl_externc size_t malloc_good_size(size_t size);
|
mi_decl_externc size_t malloc_good_size(size_t size);
|
||||||
|
@ -77,7 +78,9 @@ typedef struct mi_nothrow_s { int _tag; } mi_nothrow_t;
|
||||||
MI_INTERPOSE_MI(valloc),
|
MI_INTERPOSE_MI(valloc),
|
||||||
MI_INTERPOSE_MI(malloc_size),
|
MI_INTERPOSE_MI(malloc_size),
|
||||||
MI_INTERPOSE_MI(malloc_good_size),
|
MI_INTERPOSE_MI(malloc_good_size),
|
||||||
|
#if defined(MAC_OS_X_VERSION_10_15) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15
|
||||||
MI_INTERPOSE_MI(aligned_alloc),
|
MI_INTERPOSE_MI(aligned_alloc),
|
||||||
|
#endif
|
||||||
#ifdef MI_OSX_ZONE
|
#ifdef MI_OSX_ZONE
|
||||||
// we interpose malloc_default_zone in alloc-override-osx.c so we can use mi_free safely
|
// we interpose malloc_default_zone in alloc-override-osx.c so we can use mi_free safely
|
||||||
MI_INTERPOSE_MI(free),
|
MI_INTERPOSE_MI(free),
|
||||||
|
@ -161,7 +164,9 @@ typedef struct mi_nothrow_s { int _tag; } mi_nothrow_t;
|
||||||
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::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& tag) noexcept { mi_free_aligned(p, static_cast<size_t>(al)); }
|
||||||
|
void operator delete[](void* p, std::align_val_t al, const std::nothrow_t& tag) 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) 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)); }
|
||||||
|
|
|
@ -195,6 +195,7 @@ static bool os_random_buf(void* buf, size_t buf_len) {
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#if defined(MAC_OS_X_VERSION_10_10) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
#if defined(MAC_OS_X_VERSION_10_10) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||||
|
#include <CommonCrypto/CommonCryptoError.h>
|
||||||
#include <CommonCrypto/CommonRandom.h>
|
#include <CommonCrypto/CommonRandom.h>
|
||||||
#endif
|
#endif
|
||||||
static bool os_random_buf(void* buf, size_t buf_len) {
|
static bool os_random_buf(void* buf, size_t buf_len) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue