summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-06-23 16:19:13 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-03 02:49:27 -0400
commit8cc7274b8de254c7266b61fadbc6795dc37bd1e9 (patch)
tree4462f93d386fe2d1a928d45bb4d7f55c34a6b259
parentf08d6316d3d19b627550d99b4364e9bf0b45c329 (diff)
downloadhaskell-8cc7274b8de254c7266b61fadbc6795dc37bd1e9.tar.gz
rts/ProfHeap: Only allocate the Censuses that we need
When not LDV profiling there is no reason to allocate 32 Censuses; one will do. This is a very small memory footprint optimisation, but it comes for free.
-rw-r--r--rts/ProfHeap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index 43bce78b76..0b7b386249 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -498,16 +498,17 @@ initHeapProfiling(void)
#if defined(PROFILING)
if (doingLDVProfiling()) {
era = 1;
+ n_censuses = 32;
} else
#endif
{
era = 0;
+ n_censuses = 1;
}
// max_era = 2^LDV_SHIFT
max_era = 1 << LDV_SHIFT;
- n_censuses = 32;
censuses = stgMallocBytes(sizeof(Census) * n_censuses, "initHeapProfiling");
initEra( &censuses[era] );