From 722900d8a3d4fac53e326d1f6d76f81b0b2f0c9a Mon Sep 17 00:00:00 2001 From: ssilagadze Date: Fri, 5 Jan 2024 13:19:01 +0400 Subject: [PATCH 1/2] make sure we dealocate slice --- blocktx/peer_handler.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/blocktx/peer_handler.go b/blocktx/peer_handler.go index e3a912527..3a206a369 100644 --- a/blocktx/peer_handler.go +++ b/blocktx/peer_handler.go @@ -495,8 +495,11 @@ func (bs *PeerHandler) markTransactionsAsMined(blockId uint64, merkleTree []*cha return fmt.Errorf("failed to insert block transactions at block height %d: %v", blockHeight, err) } // free up memory - txs = txs[:0] - merklePaths = merklePaths[:0] + txs = nil + merklePaths = nil + + txs = make([]*blocktx_api.TransactionAndSource, 0, bs.transactionStorageBatchSize) + merklePaths = make([]string, 0, bs.transactionStorageBatchSize) // print stats, call gc and chec the result bs.printMemStats() From cbc20b1163f0940d121522418be27637183dc1b9 Mon Sep 17 00:00:00 2001 From: ssilagadze Date: Fri, 5 Jan 2024 13:25:06 +0400 Subject: [PATCH 2/2] remove ineffectual assignment --- blocktx/peer_handler.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/blocktx/peer_handler.go b/blocktx/peer_handler.go index 3a206a369..b3f9766ea 100644 --- a/blocktx/peer_handler.go +++ b/blocktx/peer_handler.go @@ -495,9 +495,6 @@ func (bs *PeerHandler) markTransactionsAsMined(blockId uint64, merkleTree []*cha return fmt.Errorf("failed to insert block transactions at block height %d: %v", blockHeight, err) } // free up memory - txs = nil - merklePaths = nil - txs = make([]*blocktx_api.TransactionAndSource, 0, bs.transactionStorageBatchSize) merklePaths = make([]string, 0, bs.transactionStorageBatchSize)