mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 22:23:22 +00:00
scoping th solver to avoid memory leak during cancellation exposed by #3431
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
d1f6470805
commit
70a1786061
5 changed files with 10 additions and 6 deletions
|
@ -1824,6 +1824,7 @@ ast * ast_manager::register_node_core(ast * n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
n->m_id = is_decl(n) ? m_decl_id_gen.mk() : m_expr_id_gen.mk();
|
n->m_id = is_decl(n) ? m_decl_id_gen.mk() : m_expr_id_gen.mk();
|
||||||
|
|
||||||
TRACE("ast", tout << "Object " << n->m_id << " was created.\n";);
|
TRACE("ast", tout << "Object " << n->m_id << " was created.\n";);
|
||||||
TRACE("mk_var_bug", tout << "mk_ast: " << n->m_id << "\n";);
|
TRACE("mk_var_bug", tout << "mk_ast: " << n->m_id << "\n";);
|
||||||
// increment reference counters
|
// increment reference counters
|
||||||
|
|
|
@ -275,7 +275,7 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
|
||||||
|
|
||||||
unsigned new_num_args = result_stack().size() - fr.m_spos;
|
unsigned new_num_args = result_stack().size() - fr.m_spos;
|
||||||
expr * const * new_args = result_stack().c_ptr() + fr.m_spos;
|
expr * const * new_args = result_stack().c_ptr() + fr.m_spos;
|
||||||
app * new_t;
|
app_ref new_t(m());
|
||||||
if (ProofGen) {
|
if (ProofGen) {
|
||||||
elim_reflex_prs(fr.m_spos);
|
elim_reflex_prs(fr.m_spos);
|
||||||
unsigned num_prs = result_pr_stack().size() - fr.m_spos;
|
unsigned num_prs = result_pr_stack().size() - fr.m_spos;
|
||||||
|
|
|
@ -2152,12 +2152,12 @@ namespace qe {
|
||||||
|
|
||||||
expr_ref fml0(fml, m);
|
expr_ref fml0(fml, m);
|
||||||
|
|
||||||
quant_elim_plugin* th;
|
scoped_ptr<quant_elim_plugin> th;
|
||||||
pop_context(th);
|
pop_context(th);
|
||||||
|
|
||||||
th->check(num_vars, vars, m_assumption, fml, get_first, free_vars, defs);
|
th->check(num_vars, vars, m_assumption, fml, get_first, free_vars, defs);
|
||||||
|
|
||||||
push_context(th);
|
push_context(th.detach());
|
||||||
TRACE("qe",
|
TRACE("qe",
|
||||||
for (unsigned i = 0; i < num_vars; ++i) {
|
for (unsigned i = 0; i < num_vars; ++i) {
|
||||||
tout << mk_ismt2_pp(vars[i], m) << " ";
|
tout << mk_ismt2_pp(vars[i], m) << " ";
|
||||||
|
@ -2175,7 +2175,7 @@ namespace qe {
|
||||||
return l_undef;
|
return l_undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pop_context(quant_elim_plugin*& th) {
|
void pop_context(scoped_ptr<quant_elim_plugin>& th) {
|
||||||
if (m_plugins.empty()) {
|
if (m_plugins.empty()) {
|
||||||
th = alloc(quant_elim_plugin, m, *this, m_fparams);
|
th = alloc(quant_elim_plugin, m, *this, m_fparams);
|
||||||
th->add_plugin(mk_bool_plugin(*th));
|
th->add_plugin(mk_bool_plugin(*th));
|
||||||
|
|
|
@ -51,6 +51,9 @@ namespace smt {
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conflict_resolution::~conflict_resolution() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Mark all enodes in a 'proof' tree branch starting at n
|
\brief Mark all enodes in a 'proof' tree branch starting at n
|
||||||
n -> ... -> root
|
n -> ... -> root
|
||||||
|
@ -1044,7 +1047,7 @@ namespace smt {
|
||||||
TRACE("proof_gen_bug", tout << "js2pr_cached: #" << js << "\n";);
|
TRACE("proof_gen_bug", tout << "js2pr_cached: #" << js << "\n";);
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
SASSERT(js != 0);
|
SASSERT(js != nullptr);
|
||||||
TRACE("proof_gen_bug", tout << js << "\n";);
|
TRACE("proof_gen_bug", tout << js << "\n";);
|
||||||
m_todo_pr.push_back(tp_elem(js));
|
m_todo_pr.push_back(tp_elem(js));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -208,7 +208,7 @@ namespace smt {
|
||||||
vector<watch_list> & watches
|
vector<watch_list> & watches
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual ~conflict_resolution() {}
|
virtual ~conflict_resolution();
|
||||||
|
|
||||||
virtual bool resolve(b_justification conflict, literal not_l);
|
virtual bool resolve(b_justification conflict, literal not_l);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue