Skip to content

Commit 06ddffa

Browse files
committed
Add bangs for avoiding retaining the ProtocolInfo and LedgerDbArgs
1 parent 9ac10c7 commit 06ddffa

File tree

6 files changed

+53
-4
lines changed

6 files changed

+53
-4
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
### Patch
9+
10+
- Ensure the `ProtocolInfo` is garbage collected once we start Consensus.
11+
12+
<!--
13+
### Non-Breaking
14+
15+
- A bullet item for the Non-Breaking category.
16+
17+
-->
18+
<!--
19+
### Breaking
20+
21+
- A bullet item for the Breaking category.
22+
23+
-->

ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Node.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE BangPatterns #-}
12
{-# LANGUAGE ConstraintKinds #-}
23
{-# LANGUAGE DataKinds #-}
34
{-# LANGUAGE DuplicateRecordFields #-}
@@ -632,7 +633,7 @@ runWith RunNodeArgs{..} encAddrNtN decAddrNtN LowLevelRunNodeArgs{..} =
632633
} = rnProtocolInfo
633634

634635
codecConfig :: CodecConfig blk
635-
codecConfig = configCodec cfg
636+
!codecConfig = configCodec cfg
636637

637638
mkNodeToNodeApps ::
638639
NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk ->
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
### Patch
9+
10+
- Ensure the `LedgerDbArgs` are garbage collected once we start the LedgerDB.
11+
- Ensure the `ProtocolInfo` is garbage collected once we start Consensus.
12+
13+
<!--
14+
### Non-Breaking
15+
16+
- A bullet item for the Non-Breaking category.
17+
18+
-->
19+
<!--
20+
### Breaking
21+
22+
- A bullet item for the Breaking category.
23+
24+
-->

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Node/ProtocolInfo.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enumCoreNodes (NumCoreNodes numNodes) =
3535

3636
-- | Data required to run the specified protocol.
3737
data ProtocolInfo b = ProtocolInfo
38-
{ pInfoConfig :: TopLevelConfig b
38+
{ pInfoConfig :: !(TopLevelConfig b)
3939
, pInfoInitLedger :: ExtLedgerState b ValuesMK
4040
-- ^ At genesis, this LedgerState must contain the UTxOs for the initial
4141
-- era (which for Cardano is Byron that has void tables).

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Args.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ data LedgerDbArgs f m blk = LedgerDbArgs
5757
, lgrGenesis :: HKD f (m (ExtLedgerState blk ValuesMK))
5858
, lgrHasFS :: HKD f (SomeHasFS m)
5959
, lgrConfig :: LedgerDbCfgF f (ExtLedgerState blk)
60-
, lgrTracer :: Tracer m (TraceEvent blk)
60+
, lgrTracer :: !(Tracer m (TraceEvent blk))
6161
, lgrBackendArgs :: LedgerDbBackendArgs m blk
6262
, lgrRegistry :: HKD f (ResourceRegistry m)
6363
, lgrQueryBatchSize :: QueryBatchSize

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V1.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ mkInitDb args bss getBlock snapManager getVolatileSuffix =
149149
pure $ implMkLedgerDb h snapManager
150150
}
151151
where
152-
bsTracer = LedgerDBFlavorImplEvent . FlavorImplSpecificTraceV1 >$< lgrTracer
152+
!bsTracer = LedgerDBFlavorImplEvent . FlavorImplSpecificTraceV1 >$< tr
153+
!tr = lgrTracer
153154

154155
LedgerDbArgs
155156
{ lgrHasFS

0 commit comments

Comments
 (0)