Skip to content

Commit

Permalink
Fix mpfr leak
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanradanov committed Nov 8, 2024
1 parent f2070b0 commit 52e902f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions enzyme/Enzyme/Runtimes/FPRT/GarbageCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct GCFloatTy {
__enzyme_fp fp;
bool seen;
GCFloatTy() : seen(false) {}
~GCFloatTy() {}
};
struct {
std::list<GCFloatTy> all;
Expand Down Expand Up @@ -118,6 +119,7 @@ void enzyme_fprt_gc_doit() {
for (auto it = __enzyme_mpfr_fps.all.begin();
it != __enzyme_mpfr_fps.all.end();) {
if (!it->seen) {
mpfr_clear(it->fp.result);
it = __enzyme_mpfr_fps.all.erase(it);
} else {
++it;
Expand Down

0 comments on commit 52e902f

Please sign in to comment.