summaryrefslogtreecommitdiff
path: root/rts/ProfHeap.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-11-13 10:21:47 +0000
committerSimon Marlow <marlowsd@gmail.com>2013-11-14 12:07:33 +0000
commit334545e010051f31266f6637fa999d1df438b065 (patch)
treeaf37e5cbf56e8dd82350bfb9a5573bed671cb575 /rts/ProfHeap.c
parent69559a42c3dcf97afd0f394b06a8186edce0744f (diff)
downloadhaskell-334545e010051f31266f6637fa999d1df438b065.tar.gz
fix a small memory leak with +RTS -hb
Diffstat (limited to 'rts/ProfHeap.c')
-rw-r--r--rts/ProfHeap.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index f094038235..6d78886e39 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -262,12 +262,8 @@ initEra(Census *census)
STATIC_INLINE void
freeEra(Census *census)
{
- if (RtsFlags.ProfFlags.bioSelector != NULL)
- // when bioSelector==NULL, these are freed in heapCensus()
- {
- arenaFree(census->arena);
- freeHashTable(census->hash, NULL);
- }
+ arenaFree(census->arena);
+ freeHashTable(census->hash, NULL);
}
/* --------------------------------------------------------------------------
@@ -467,8 +463,12 @@ endHeapProfiling(void)
#ifdef PROFILING
if (doingLDVProfiling()) {
nat t;
- for (t = 1; t <= era; t++) {
- freeEra( &censuses[t] );
+ if (RtsFlags.ProfFlags.bioSelector != NULL) {
+ for (t = 1; t <= era; t++) {
+ freeEra( &censuses[t] );
+ }
+ } else {
+ freeEra( &censuses[era] );
}
} else {
freeEra( &censuses[0] );
@@ -1125,8 +1125,7 @@ void heapCensus (Time t)
#ifdef PROFILING
if (RtsFlags.ProfFlags.bioSelector == NULL)
{
- freeHashTable( census->hash, NULL/* don't free the elements */ );
- arenaFree( census->arena );
+ freeEra(census);
census->hash = NULL;
census->arena = NULL;
}