3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 18:31:49 +00:00

ctx-simplify: fix mem leak of simplifier

This commit is contained in:
Nuno Lopes 2016-02-19 11:08:01 +00:00
parent c618838ed9
commit 7d3af70a63
2 changed files with 8 additions and 8 deletions

View file

@ -180,6 +180,7 @@ struct ctx_simplify_tactic::imp {
pop(scope_level());
SASSERT(scope_level() == 0);
restore_cache(0);
dealloc(m_simp);
DEBUG_CODE({
for (unsigned i = 0; i < m_cache.size(); i++) {
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):
m_imp(alloc(imp, m, simp, p)),
m_params(p),
m_simp(simp) {
m_params(p) {
}
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() {
dealloc(m_imp);
dealloc(m_simp);
}
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() {
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);
dealloc(d);
}

View file

@ -42,13 +42,10 @@ protected:
struct imp;
imp * m_imp;
params_ref m_params;
simplifier* m_simp;
public:
ctx_simplify_tactic(ast_manager & m, simplifier* simp, params_ref const & p = params_ref());
virtual tactic * translate(ast_manager & m) {
return alloc(ctx_simplify_tactic, m, m_simp->translate(m), m_params);
}
virtual tactic * translate(ast_manager & m);
virtual ~ctx_simplify_tactic();