[Git][ghc/ghc][master] rts: Properly free the RTSSummaryStats structure
Marge Bot
gitlab at gitlab.haskell.org
Sat May 4 00:56:11 UTC 2019
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f862963b by Ömer Sinan Ağacan at 2019-05-04T00:50:03Z
rts: Properly free the RTSSummaryStats structure
`stat_exit` always allocates a `RTSSummaryStats` but only sometimes
frees it, which casues leaks. With this patch we unconditionally free
the structure, fixing the leak.
Fixes #16584
- - - - -
1 changed file:
- rts/Stats.c
Changes:
=====================================
rts/Stats.c
=====================================
@@ -657,11 +657,8 @@ static void init_RTSSummaryStats(RTSSummaryStats* sum)
static void free_RTSSummaryStats(RTSSummaryStats * sum)
{
- if (!sum) { return; }
- if (!sum->gc_summary_stats) {
- stgFree(sum->gc_summary_stats);
- sum->gc_summary_stats = NULL;
- }
+ stgFree(sum->gc_summary_stats);
+ sum->gc_summary_stats = NULL;
}
static void report_summary(const RTSSummaryStats* sum)
@@ -1257,11 +1254,12 @@ stat_exit (void)
}
}
- free_RTSSummaryStats(&sum);
statsFlush();
statsClose();
}
+ free_RTSSummaryStats(&sum);
+
if (GC_coll_cpu) {
stgFree(GC_coll_cpu);
GC_coll_cpu = NULL;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/f862963b6cdd217730e4f36f07ad52ac9f7be7f3
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/f862963b6cdd217730e4f36f07ad52ac9f7be7f3
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190503/348b6d18/attachment-0001.html>
More information about the ghc-commits
mailing list