Skip to content

Commit 14f8bdb

Browse files
banks: fixing cost tracker leak
1 parent 8eb4371 commit 14f8bdb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/flamenco/runtime/fd_bank.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,17 @@ fd_banks_advance_root( fd_banks_t * banks,
818818
#undef HAS_COW_0
819819
#undef HAS_COW_1
820820

821+
/* It is possible for a bank that never finished replaying to be
822+
pruned away. If the bank was never frozen, then it's possible
823+
that the bank still owns a cost tracker pool element. If this
824+
is the case, we need to release the pool element. */
825+
if( head->cost_tracker_pool_idx!=fd_bank_cost_tracker_pool_idx_null( fd_bank_get_cost_tracker_pool( head )) ) {
826+
FD_TEST( !(head->flags&FD_BANK_FLAGS_FROZEN) && head->flags&FD_BANK_FLAGS_REPLAYABLE );
827+
FD_LOG_DEBUG(( "releasing cost tracker pool element for bank at index %lu at slot %lu", head->idx, fd_bank_slot_get( head ) ));
828+
fd_bank_cost_tracker_pool_idx_release( fd_bank_get_cost_tracker_pool( head ), head->cost_tracker_pool_idx );
829+
head->cost_tracker_pool_idx = fd_bank_cost_tracker_pool_idx_null( fd_bank_get_cost_tracker_pool( head ) );
830+
}
831+
821832
head->flags = 0UL;
822833
fd_banks_pool_ele_release( bank_pool, head );
823834
head = next;

0 commit comments

Comments
 (0)