mirror of
https://github.com/Z3Prover/z3
synced 2025-06-21 13:23:39 +00:00
ctx-simplify: fix mem leak of simplifier
This commit is contained in:
parent
c618838ed9
commit
7d3af70a63
2 changed files with 8 additions and 8 deletions
|
@ -180,6 +180,7 @@ struct ctx_simplify_tactic::imp {
|
||||||
pop(scope_level());
|
pop(scope_level());
|
||||||
SASSERT(scope_level() == 0);
|
SASSERT(scope_level() == 0);
|
||||||
restore_cache(0);
|
restore_cache(0);
|
||||||
|
dealloc(m_simp);
|
||||||
DEBUG_CODE({
|
DEBUG_CODE({
|
||||||
for (unsigned i = 0; i < m_cache.size(); i++) {
|
for (unsigned i = 0; i < m_cache.size(); i++) {
|
||||||
CTRACE("ctx_simplify_tactic_bug", m_cache[i].m_from,
|
CTRACE("ctx_simplify_tactic_bug", m_cache[i].m_from,
|
||||||
|
@ -572,13 +573,15 @@ struct ctx_simplify_tactic::imp {
|
||||||
|
|
||||||
ctx_simplify_tactic::ctx_simplify_tactic(ast_manager & m, simplifier* simp, params_ref const & p):
|
ctx_simplify_tactic::ctx_simplify_tactic(ast_manager & m, simplifier* simp, params_ref const & p):
|
||||||
m_imp(alloc(imp, m, simp, p)),
|
m_imp(alloc(imp, m, simp, p)),
|
||||||
m_params(p),
|
m_params(p) {
|
||||||
m_simp(simp) {
|
}
|
||||||
|
|
||||||
|
tactic * ctx_simplify_tactic::translate(ast_manager & m) {
|
||||||
|
return alloc(ctx_simplify_tactic, m, m_imp->m_simp->translate(m), m_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx_simplify_tactic::~ctx_simplify_tactic() {
|
ctx_simplify_tactic::~ctx_simplify_tactic() {
|
||||||
dealloc(m_imp);
|
dealloc(m_imp);
|
||||||
dealloc(m_simp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctx_simplify_tactic::updt_params(params_ref const & p) {
|
void ctx_simplify_tactic::updt_params(params_ref const & p) {
|
||||||
|
@ -606,7 +609,7 @@ void ctx_simplify_tactic::operator()(goal_ref const & in,
|
||||||
|
|
||||||
void ctx_simplify_tactic::cleanup() {
|
void ctx_simplify_tactic::cleanup() {
|
||||||
ast_manager & m = m_imp->m;
|
ast_manager & m = m_imp->m;
|
||||||
imp * d = alloc(imp, m, m_simp->translate(m), m_params);
|
imp * d = alloc(imp, m, m_imp->m_simp->translate(m), m_params);
|
||||||
std::swap(d, m_imp);
|
std::swap(d, m_imp);
|
||||||
dealloc(d);
|
dealloc(d);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,10 @@ protected:
|
||||||
struct imp;
|
struct imp;
|
||||||
imp * m_imp;
|
imp * m_imp;
|
||||||
params_ref m_params;
|
params_ref m_params;
|
||||||
simplifier* m_simp;
|
|
||||||
public:
|
public:
|
||||||
ctx_simplify_tactic(ast_manager & m, simplifier* simp, params_ref const & p = params_ref());
|
ctx_simplify_tactic(ast_manager & m, simplifier* simp, params_ref const & p = params_ref());
|
||||||
|
|
||||||
virtual tactic * translate(ast_manager & m) {
|
virtual tactic * translate(ast_manager & m);
|
||||||
return alloc(ctx_simplify_tactic, m, m_simp->translate(m), m_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~ctx_simplify_tactic();
|
virtual ~ctx_simplify_tactic();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue