3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

fix memory leak when using prime_generator as non-static object

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-06-12 11:14:25 -07:00
parent 110ca25e1b
commit bd109c4522
3 changed files with 7 additions and 1 deletions

View file

@ -38,5 +38,5 @@ void tst_prime_generator() {
ENSURE(p % i != 0);
}
}
std::cout << std::endl;
std::cout << std::endl;
}

View file

@ -27,6 +27,11 @@ prime_generator::prime_generator() {
process_next_k_numbers(128);
}
prime_generator::~prime_generator() {
dealloc(m_mux);
m_mux = nullptr;
}
void prime_generator::process_next_k_numbers(uint64_t k) {
svector<uint64_t> todo;
uint64_t begin = m_primes.back() + 2;

View file

@ -38,6 +38,7 @@ class prime_generator {
public:
mutex *m_mux;
prime_generator();
~prime_generator();
uint64_t operator()(unsigned idx);
void finalize();
};