collect garbage at end of each slot (#975)
This commit is contained in:
parent
3f7f444ce7
commit
a56e18bb0c
|
@ -902,6 +902,16 @@ proc onSlotStart(node: BeaconNode, lastSlot, scheduledSlot: Slot) {.gcsafe, asyn
|
||||||
finalizedRoot = shortLog(node.blockPool.finalizedHead.blck.root),
|
finalizedRoot = shortLog(node.blockPool.finalizedHead.blck.root),
|
||||||
cat = "scheduling"
|
cat = "scheduling"
|
||||||
|
|
||||||
|
when declared(GC_fullCollect):
|
||||||
|
# The slots in the beacon node work as frames in a game: we want to make
|
||||||
|
# sure that we're ready for the next one and don't get stuck in lengthy
|
||||||
|
# garbage collection tasks when time is of essence in the middle of a slot -
|
||||||
|
# while this does not guarantee that we'll never collect during a slot, it
|
||||||
|
# makes sure that all the scratch space we used during slot tasks (logging,
|
||||||
|
# temporary buffers etc) gets recycled for the next slot that is likely to
|
||||||
|
# need similar amounts of memory.
|
||||||
|
GC_fullCollect()
|
||||||
|
|
||||||
addTimer(nextSlotStart) do (p: pointer):
|
addTimer(nextSlotStart) do (p: pointer):
|
||||||
asyncCheck node.onSlotStart(slot, nextSlot)
|
asyncCheck node.onSlotStart(slot, nextSlot)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue