3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-26 21:16:02 +00:00

restore most global muxes as heap-allocated to avoid crashes with hard-kills like ctrl-c

This commit is contained in:
Nuno Lopes 2019-06-13 18:42:57 +01:00
parent d17248821a
commit c21f0c2f00
8 changed files with 55 additions and 49 deletions

View file

@ -35,11 +35,7 @@ out_of_memory_error::out_of_memory_error():z3_error(ERR_MEMOUT) {
}
#ifndef SINGLE_THREAD
static mutex *g_memory_mux = new mutex;
#else
static mutex *g_memory_mux = nullptr;
#endif
static DECLARE_MUTEX(g_memory_mux);
static atomic<bool> g_memory_out_of_memory(false);
static bool g_memory_initialized = false;
static long long g_memory_alloc_size = 0;
@ -138,9 +134,7 @@ void memory::finalize() {
if (g_memory_initialized) {
g_finalizing = true;
mem_finalize();
#ifndef SINGLE_THREAD
delete g_memory_mux;
#endif
g_memory_initialized = false;
g_finalizing = false;
}