3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-27 08:28:44 +00:00

fix crash on Mac due to different destruction order of globals

the mutex in memory_manager has to be destroyed after all mem deallocations happen
This commit is contained in:
Nuno Lopes 2019-06-13 11:22:18 +01:00
parent 2bee9a062f
commit cf3e649462
12 changed files with 80 additions and 120 deletions

View file

@ -18,7 +18,6 @@ Revision History:
--*/
#include<iostream>
#include<mutex>
#include "util/memory_manager.h"
#include "util/trace.h"
#include "util/debug.h"
@ -51,7 +50,6 @@ static char const * g_input_file = nullptr;
static bool g_standard_input = false;
static input_kind g_input_kind = IN_UNSPECIFIED;
bool g_display_statistics = false;
std::mutex* g_stat_mux = nullptr;
static bool g_display_istatistics = false;
static void error(const char * msg) {
@ -313,7 +311,6 @@ int STD_CALL main(int argc, char ** argv) {
unsigned return_value = 0;
memory::initialize(0);
memory::exit_when_out_of_memory(true, "ERROR: out of memory");
g_stat_mux = alloc(std::mutex);
parse_cmd_line_args(argc, argv);
env_params::updt_params();
@ -384,7 +381,6 @@ int STD_CALL main(int argc, char ** argv) {
default:
UNREACHABLE();
}
dealloc(g_stat_mux);
memory::finalize();
#ifdef _WINDOWS
_CrtDumpMemoryLeaks();