mirror of
https://github.com/Z3Prover/z3
synced 2025-06-22 22:03:39 +00:00
memory_allocator: allocate mutex in global init since allocate() is called from API functions before memory initialization
This commit is contained in:
parent
cf3e649462
commit
38eeaeae7a
1 changed files with 5 additions and 4 deletions
|
@ -35,7 +35,11 @@ out_of_memory_error::out_of_memory_error():z3_error(ERR_MEMOUT) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static mutex *g_memory_mux;
|
#ifndef SINGLE_THREAD
|
||||||
|
static mutex *g_memory_mux = new mutex;
|
||||||
|
#else
|
||||||
|
static mutex *g_memory_mux = nullptr;
|
||||||
|
#endif
|
||||||
static atomic<bool> g_memory_out_of_memory(false);
|
static atomic<bool> g_memory_out_of_memory(false);
|
||||||
static bool g_memory_initialized = false;
|
static bool g_memory_initialized = false;
|
||||||
static long long g_memory_alloc_size = 0;
|
static long long g_memory_alloc_size = 0;
|
||||||
|
@ -96,9 +100,6 @@ void memory::initialize(size_t max_size) {
|
||||||
if (g_memory_initialized)
|
if (g_memory_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef SINGLE_THREAD
|
|
||||||
g_memory_mux = new mutex;
|
|
||||||
#endif
|
|
||||||
g_memory_out_of_memory = false;
|
g_memory_out_of_memory = false;
|
||||||
mem_initialize();
|
mem_initialize();
|
||||||
g_memory_initialized = true;
|
g_memory_initialized = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue