diff options
Diffstat (limited to 'src/core/function/SecureMemoryAllocator.cpp')
-rw-r--r-- | src/core/function/SecureMemoryAllocator.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/function/SecureMemoryAllocator.cpp b/src/core/function/SecureMemoryAllocator.cpp index f854f816..651e4085 100644 --- a/src/core/function/SecureMemoryAllocator.cpp +++ b/src/core/function/SecureMemoryAllocator.cpp @@ -28,6 +28,8 @@ #include "SecureMemoryAllocator.h" +#ifndef MACOS + #include <mimalloc.h> namespace GpgFrontend { @@ -38,10 +40,28 @@ auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* { } auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* { - auto* addr = realloc(ptr, size); + auto* addr = mi_realloc(ptr, size); return addr; } void SecureMemoryAllocator::Deallocate(void* p) { mi_free(p); } +#else + +namespace GpgFrontend { + +auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* { + auto* addr = malloc(size); + return addr; +} + +auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* { + auto* addr = realloc(ptr, size); + return addr; +} + +void SecureMemoryAllocator::Deallocate(void* p) { free(p); } + +#endif + } // namespace GpgFrontend
\ No newline at end of file |