summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-02-24 20:25:24 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-07 02:00:05 -0400
commitf38e8d61f066c3064c600c352eebcd87f28d989a (patch)
treeb7ad284611e27ab8c42fc8520ef4928afa3c19b1
parente850d14ffbeea39ad386b1e888cd97375758d6d6 (diff)
downloadhaskell-f38e8d61f066c3064c600c352eebcd87f28d989a.tar.gz
rts: ProfHeap: Fix memory leak when not compiled with profiling
If we're doing heap profiling on an unprofiled executable we keep allocating new space in initEra via nextEra on each profiler run but we don't have a corresponding freeEra call. We do free the last era in endHeapProfiling but previous eras will have been overwritten by initEra and will never get free()ed. Metric Decrease: space_leak_001
-rw-r--r--rts/ProfHeap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index 85f5a6c741..6c26de1699 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -1336,12 +1336,12 @@ void heapCensus (Time t)
// future restriction by biography.
#if defined(PROFILING)
if (RtsFlags.ProfFlags.bioSelector == NULL)
+#endif
{
freeEra(census);
census->hash = NULL;
census->arena = NULL;
}
-#endif
// we're into the next time period now
nextEra();