mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 04:43:39 +00:00
free memory in nex_creator during GB init
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
519bbc5af1
commit
580f229a16
3 changed files with 8 additions and 3 deletions
|
@ -593,7 +593,7 @@ void nex_creator::process_map_pair(nex*e, const rational& coeff, nex_sum & sum,
|
||||||
}
|
}
|
||||||
bool e_is_old = allocated_nexs.find(e) != allocated_nexs.end();
|
bool e_is_old = allocated_nexs.find(e) != allocated_nexs.end();
|
||||||
if (!e_is_old) {
|
if (!e_is_old) {
|
||||||
m_allocated.push_back(e);
|
add_to_allocated(e);
|
||||||
}
|
}
|
||||||
if (e->is_mul()) {
|
if (e->is_mul()) {
|
||||||
e->to_mul().m_coeff = coeff;
|
e->to_mul().m_coeff = coeff;
|
||||||
|
|
|
@ -155,7 +155,10 @@ public:
|
||||||
const std::unordered_map<lpvar, unsigned>& powers() const { return m_powers; }
|
const std::unordered_map<lpvar, unsigned>& powers() const { return m_powers; }
|
||||||
std::unordered_map<lpvar, unsigned>& powers() { return m_powers; }
|
std::unordered_map<lpvar, unsigned>& powers() { return m_powers; }
|
||||||
|
|
||||||
void add_to_allocated(nex* r) { m_allocated.push_back(r); }
|
void add_to_allocated(nex* r) {
|
||||||
|
m_allocated.push_back(r);
|
||||||
|
CTRACE("grobner_stats_d", m_allocated.size() % 1000 == 0, tout << "m_allocated.size() = " << m_allocated.size() << "\n";);
|
||||||
|
}
|
||||||
|
|
||||||
// NSB: we can use region allocation, but still need to invoke destructor
|
// NSB: we can use region allocation, but still need to invoke destructor
|
||||||
// because of 'rational' (and m_children in nex_mul unless we get rid of this)
|
// because of 'rational' (and m_children in nex_mul unless we get rid of this)
|
||||||
|
@ -163,6 +166,7 @@ public:
|
||||||
for (unsigned j = sz; j < m_allocated.size(); j++)
|
for (unsigned j = sz; j < m_allocated.size(); j++)
|
||||||
dealloc(m_allocated[j]);
|
dealloc(m_allocated[j]);
|
||||||
m_allocated.resize(sz);
|
m_allocated.resize(sz);
|
||||||
|
TRACE("grobner_stats_d", tout << "m_allocated.size() = " << m_allocated.size() << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
|
|
|
@ -250,6 +250,7 @@ grobner_core::equation_set const& grobner_core::equations() {
|
||||||
|
|
||||||
void grobner_core::reset() {
|
void grobner_core::reset() {
|
||||||
del_equations(0);
|
del_equations(0);
|
||||||
|
m_nex_creator.pop(0);
|
||||||
SASSERT(m_equations_to_delete.empty());
|
SASSERT(m_equations_to_delete.empty());
|
||||||
m_to_superpose.reset();
|
m_to_superpose.reset();
|
||||||
m_to_simplify.reset();
|
m_to_simplify.reset();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue