From 6aba58456c03745d0ec6e4de702b51c4521fd906 Mon Sep 17 00:00:00 2001 From: kderme Date: Sat, 22 Aug 2020 20:05:36 +0300 Subject: [PATCH] Fix laziness --- .../src/Ouroboros/Consensus/Storage/LedgerDB/InMemory.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/Storage/LedgerDB/InMemory.hs b/ouroboros-consensus/src/Ouroboros/Consensus/Storage/LedgerDB/InMemory.hs index 0c65c176662..8017a14b407 100644 --- a/ouroboros-consensus/src/Ouroboros/Consensus/Storage/LedgerDB/InMemory.hs +++ b/ouroboros-consensus/src/Ouroboros/Consensus/Storage/LedgerDB/InMemory.hs @@ -612,6 +612,11 @@ prune db@LedgerDB{..} = toPrune :: Int toPrune = ledgerDbCountToPrune ledgerDbParams (Seq.length ledgerDbBlocks) + -- NOTE: we must inline 'prune' otherwise we get unexplained thunks in + -- 'LedgerDB' and thus a space leak. Alternatively, we could disable the + -- @-fstrictness@ optimisation (enabled by default for -O1). See #2532. +{-# INLINE prune #-} + -- | Push an updated ledger state pushLedgerState :: l -- ^ Updated ledger state -> r -- ^ Reference to the applied block