mirror of
https://github.com/Z3Prover/z3
synced 2026-02-09 10:35:36 +00:00
Revert "Fix memory leak in mpz pointer tagging implementation"
This reverts commit64d5544a32. As explained by @NikolajBjorner, the original implementation intentionally did NOT free memory on set() calls. This was a performance optimization to avoid reallocating memory when the mpz cell needs large numbers again later. The deallocate() calls introduced in the previous commit would cause performance regressions, particularly in code paths like Simplex that frequently reset values. The actual memory leak must be in the original pointer tagging commit (2f4abe2ce6) and needs to be fixed there rather than by adding deallocate() calls in set() methods. Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
64d5544a32
commit
b13784b3e0
1 changed files with 0 additions and 4 deletions
|
|
@ -299,7 +299,6 @@ class mpz_manager {
|
|||
|
||||
void set_i64(mpz & c, int64_t v) {
|
||||
if (v >= INT_MIN && v <= INT_MAX) {
|
||||
deallocate(c); // Free any existing large value before setting small
|
||||
c.set(static_cast<int>(v));
|
||||
}
|
||||
else {
|
||||
|
|
@ -590,7 +589,6 @@ public:
|
|||
|
||||
void set(mpz & target, mpz const & source) {
|
||||
if (is_small(source)) {
|
||||
deallocate(target); // Free any existing large value before setting small
|
||||
target.set(source.value());
|
||||
}
|
||||
else {
|
||||
|
|
@ -599,7 +597,6 @@ public:
|
|||
}
|
||||
|
||||
void set(mpz & a, int val) {
|
||||
deallocate(a); // Free any existing large value before setting small
|
||||
a.set(val);
|
||||
}
|
||||
|
||||
|
|
@ -618,7 +615,6 @@ public:
|
|||
|
||||
void set(mpz & a, uint64_t val) {
|
||||
if (val < INT_MAX) {
|
||||
deallocate(a); // Free any existing large value before setting small
|
||||
a.set(static_cast<int>(val));
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue