3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-19 00:38:57 +00:00

broke dependency between components that need initialization and memory_manager

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-11-17 11:30:25 -08:00
parent 570147e326
commit ed5d154f78
7 changed files with 103 additions and 14 deletions

View file

@ -1,13 +1,27 @@
#include<iostream>
#include<stdlib.h>
#include"trace.h"
#include"memory_manager.h"
#include"rational.h"
#include"prime_generator.h"
#include"debug.h"
#include"error_codes.h"
// The following two function are automatically generated by the mk_make.py script.
// The script collects ADD_INITIALIZER and ADD_FINALIZER commands in the .h files.
// For example, rational.h contains
// ADD_INITIALIZER('rational::initialize();')
// ADD_FINALIZER('rational::finalize();')
// Thus, any executable or shared object (DLL) that depends on rational.h
// will have an automalically generated file mem_initializer.cpp containing
// mem_initialize()
// mem_finalize()
// and these functions will include the statements:
// rational::initialize();
//
// rational::finalize();
void mem_initialize();
void mem_finalize();
// If PROFILE_MEMORY is defined, Z3 will display the amount of memory used, and the number of synchronization steps during finalization
// #define PROFILE_MEMORY
void initialize_symbols();
void finalize_symbols();
out_of_memory_error::out_of_memory_error():z3_error(ERR_MEMOUT) {
}
@ -58,8 +72,7 @@ mem_usage_report g_info;
void memory::initialize(size_t max_size) {
g_memory_out_of_memory = false;
g_memory_max_size = max_size;
rational::initialize();
initialize_symbols();
mem_initialize();
}
bool memory::is_out_of_memory() {
@ -96,14 +109,9 @@ static bool g_finalizing = false;
void memory::finalize() {
g_finalizing = true;
finalize_debug();
finalize_trace();
finalize_symbols();
rational::finalize();
prime_iterator::finalize();
mem_finalize();
}
unsigned long long memory::get_allocation_size() {
long long r;
#pragma omp critical (z3_memory_manager)