3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-13 06:30:54 +00:00

working on new parameter framework

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-12-01 15:54:34 -08:00
parent be5f933201
commit 589f096e6e
36 changed files with 436 additions and 377 deletions

View file

@ -1,9 +1,9 @@
#include<iostream>
#include<stdlib.h>
#include<limits.h>
#include"trace.h"
#include"memory_manager.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
@ -27,6 +27,7 @@ out_of_memory_error::out_of_memory_error():z3_error(ERR_MEMOUT) {
}
volatile bool g_memory_out_of_memory = false;
bool g_memory_initialized = false;
long long g_memory_alloc_size = 0;
long long g_memory_max_size = 0;
long long g_memory_max_used_size = 0;
@ -70,8 +71,20 @@ mem_usage_report g_info;
#endif
void memory::initialize(size_t max_size) {
bool initialize = false;
#pragma omp critical (z3_memory_manager)
{
// only update the maximum size if max_size != UINT_MAX
if (max_size != UINT_MAX)
g_memory_max_size = max_size;
if (!g_memory_initialized) {
g_memory_initialized = true;
initialize = true;
}
}
if (!initialize)
return;
g_memory_out_of_memory = false;
g_memory_max_size = max_size;
mem_initialize();
}
@ -108,8 +121,12 @@ void memory::set_max_size(size_t max_size) {
static bool g_finalizing = false;
void memory::finalize() {
g_finalizing = true;
mem_finalize();
if (g_memory_initialized) {
g_finalizing = true;
mem_finalize();
g_memory_initialized = false;
g_finalizing = false;
}
}
unsigned long long memory::get_allocation_size() {