[Git][ghc/ghc][master] rts: ProfHeap: Fix memory leak when not compiled with profiling

Marge Bot gitlab at gitlab.haskell.org
Tue Apr 7 06:00:15 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
f38e8d61 by Daniel Gröber at 2020-04-07T02:00:05-04:00
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

- - - - -


1 changed file:

- rts/ProfHeap.c


Changes:

=====================================
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();



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f38e8d61f066c3064c600c352eebcd87f28d989a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f38e8d61f066c3064c600c352eebcd87f28d989a
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/20200407/67417c93/attachment.html>


More information about the ghc-commits mailing list