Commit 334545e0 authored by Simon Marlow's avatar Simon Marlow
Browse files

fix a small memory leak with +RTS -hb

parent 69559a42
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment