aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/memory/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/memory/memory.cpp')
-rw-r--r--src/zencore/memory/memory.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/zencore/memory/memory.cpp b/src/zencore/memory/memory.cpp
index fc8de5d02..9e19c5db7 100644
--- a/src/zencore/memory/memory.cpp
+++ b/src/zencore/memory/memory.cpp
@@ -1,5 +1,7 @@
// Copyright Epic Games, Inc. All Rights Reserved.
+#include <cstdlib>
+
#include <zencore/commandline.h>
#include <zencore/memory/fmalloc.h>
#include <zencore/memory/mallocansi.h>
@@ -42,14 +44,6 @@ InitGMalloc()
// when using sanitizers, we should use the default/ansi allocator
#if ZEN_OVERRIDE_NEW_DELETE
-
-# if ZEN_MIMALLOC_ENABLED
- if (Malloc == MallocImpl::None)
- {
- Malloc = MallocImpl::Mimalloc;
- }
-# endif
-
# if ZEN_RPMALLOC_ENABLED
if (Malloc == MallocImpl::None)
{
@@ -107,6 +101,16 @@ InitGMalloc()
}
};
+ // Check ZEN_MALLOC environment variable (overrides compile-time default, but not command line)
+ {
+ const char* EnvMalloc = getenv("ZEN_MALLOC");
+ if (EnvMalloc != nullptr)
+ {
+ ProcessMallocArg(std::string_view(EnvMalloc));
+ }
+ }
+
+ // Command line --malloc takes highest precedence
IterateCommandlineArgs(ProcessArg);
switch (Malloc)