mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 14:26:26 +00:00
quick/minimal mitigation of beacon_node memory usage resulting from 2*Table.defaultInitialSize pointless BeaconState objects in block pool state cache (#1002)
This commit is contained in:
parent
592d6f65c3
commit
c498103b2f
@ -233,8 +233,8 @@ proc init*(T: type BlockPool, db: BeaconChainDB,
|
||||
pending: initTable[Eth2Digest, SignedBeaconBlock](),
|
||||
missing: initTable[Eth2Digest, MissingBlock](),
|
||||
cachedStates: [
|
||||
newTable[tuple[a: Eth2Digest, b: Slot], StateData](),
|
||||
newTable[tuple[a: Eth2Digest, b: Slot], StateData]()
|
||||
newTable[tuple[a: Eth2Digest, b: Slot], StateData](initialSize = 2),
|
||||
newTable[tuple[a: Eth2Digest, b: Slot], StateData](initialSize = 2)
|
||||
],
|
||||
blocks: blocks,
|
||||
tail: tailRef,
|
||||
@ -383,7 +383,7 @@ proc putState(pool: BlockPool, state: HashedBeaconState, blck: BlockRef) =
|
||||
# resulting lookback window is thus >= SLOTS_PER_EPOCH in size, while
|
||||
# bounded from above by 2*SLOTS_PER_EPOCH.
|
||||
pool.cachedStates[epochParity] =
|
||||
newTable[tuple[a: Eth2Digest, b: Slot], StateData]()
|
||||
newTable[tuple[a: Eth2Digest, b: Slot], StateData](initialSize = 2)
|
||||
else:
|
||||
# Need to be able to efficiently access states for both attestation
|
||||
# aggregation and to process block proposals going back to the last
|
||||
|
Loading…
x
Reference in New Issue
Block a user