Skip to content

Commit b571e43

Browse files
fix #4146
1 parent c5550e4 commit b571e43

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/math/polynomial/polynomial.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,11 +794,15 @@ namespace polynomial {
794794
~monomial_manager() {
795795
dec_ref(m_unit);
796796
CTRACE("polynomial", !m_monomials.empty(),
797-
tout << "monomials leaked\n";
797+
tout << "monomials leaked (can happen during cancelation)\n";
798798
for (auto * m : m_monomials) {
799799
m->display(tout << m->id() << " " << m->ref_count() << " ") << "\n";
800800
});
801-
SASSERT(m_monomials.empty());
801+
for (monomial* m : m_monomials) {
802+
unsigned obj_sz = monomial::get_obj_size(m->size());
803+
m_allocator->deallocate(obj_sz, m);
804+
}
805+
m_monomials.reset();
802806
if (m_own_allocator)
803807
dealloc(m_allocator);
804808
}

0 commit comments

Comments
 (0)