aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-23 08:47:18 +0000
committersaturneric <[email protected]>2024-01-23 08:47:18 +0000
commitb47e784004c2d429ea28b64082c3ad31ef57aa98 (patch)
tree26f261b2f8222ade2499066e6ce6f8463eed238b
parentfeat: support dark mode on windows (diff)
downloadGpgFrontend-b47e784004c2d429ea28b64082c3ad31ef57aa98.tar.gz
GpgFrontend-b47e784004c2d429ea28b64082c3ad31ef57aa98.zip
fix: mimalloc is not yet stable on windows
-rw-r--r--src/core/function/SecureMemoryAllocator.cpp8
-rw-r--r--third_party/CMakeLists.txt2
2 files changed, 4 insertions, 6 deletions
diff --git a/src/core/function/SecureMemoryAllocator.cpp b/src/core/function/SecureMemoryAllocator.cpp
index 692c36c5..fccd09fe 100644
--- a/src/core/function/SecureMemoryAllocator.cpp
+++ b/src/core/function/SecureMemoryAllocator.cpp
@@ -28,14 +28,14 @@
#include "SecureMemoryAllocator.h"
-#ifndef MACOS
+#if !defined(MACOS) && defined(DEBUG)
#include <mimalloc.h>
#endif
namespace GpgFrontend {
auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* {
-#ifndef MACOS
+#if !defined(MACOS) && defined(DEBUG)
auto* addr = mi_malloc(size);
#else
auto* addr = malloc(size);
@@ -44,7 +44,7 @@ auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* {
}
auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* {
-#ifndef MACOS
+#if !defined(MACOS) && defined(DEBUG)
auto* addr = mi_realloc(ptr, size);
#else
auto* addr = realloc(ptr, size);
@@ -53,7 +53,7 @@ auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* {
}
void SecureMemoryAllocator::Deallocate(void* p) {
-#ifndef MACOS
+#if !defined(MACOS) && defined(DEBUG)
mi_free(p);
#else
free(p);
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index dbee3026..1ab18df8 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -39,7 +39,5 @@ if(NOT APPLE)
add_subdirectory(mimalloc EXCLUDE_FROM_ALL)
endif()
-
-
set(INSTALL_GTEST OFF)
add_subdirectory(googletest EXCLUDE_FROM_ALL) \ No newline at end of file