mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Avoid leaking more popped items (#8145)
This commit is contained in:
parent
ef84972e7c
commit
d60940d7db
@ -112,7 +112,7 @@ func (bp *PeersByMinBlock) Pop() interface{} {
|
||||
old := *bp
|
||||
n := len(old)
|
||||
x := old[n-1]
|
||||
old[n-1] = PeerRef{}
|
||||
old[n-1] = PeerRef{} // avoid memory leak
|
||||
*bp = old[0 : n-1]
|
||||
return x
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ func (s *TxByPriceAndTime) Pop() interface{} {
|
||||
old := *s
|
||||
n := len(old)
|
||||
x := old[n-1]
|
||||
old[n-1] = nil
|
||||
old[n-1] = nil // avoid memory leak
|
||||
*s = old[0 : n-1]
|
||||
return x
|
||||
}
|
||||
@ -500,6 +500,7 @@ func (t *TransactionsFixedOrder) Peek() Transaction {
|
||||
|
||||
// Shift replaces the current best head with the next one from the same account.
|
||||
func (t *TransactionsFixedOrder) Shift() {
|
||||
t.Transactions[0] = nil // avoid memory leak
|
||||
t.Transactions = t.Transactions[1:]
|
||||
}
|
||||
|
||||
@ -507,6 +508,7 @@ func (t *TransactionsFixedOrder) Shift() {
|
||||
// the same account. This should be used when a transaction cannot be executed
|
||||
// and hence all subsequent ones should be discarded from the same account.
|
||||
func (t *TransactionsFixedOrder) Pop() {
|
||||
t.Transactions[0] = nil // avoid memory leak
|
||||
t.Transactions = t.Transactions[1:]
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ func (t *transactionsByGasPrice) Pop() interface{} {
|
||||
old := t.txs
|
||||
n := len(old)
|
||||
x := old[n-1]
|
||||
old[n-1] = nil
|
||||
old[n-1] = nil // avoid memory leak
|
||||
t.txs = old[0 : n-1]
|
||||
return x
|
||||
}
|
||||
@ -276,7 +276,7 @@ func (s *sortingHeap) Pop() interface{} {
|
||||
old := *s
|
||||
n := len(old)
|
||||
x := old[n-1]
|
||||
old[n-1] = nil
|
||||
old[n-1] = nil // avoid memory leak
|
||||
*s = old[0 : n-1]
|
||||
return x
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ func (iq *InsertQueue) Pop() interface{} {
|
||||
old := *iq
|
||||
n := len(old)
|
||||
x := old[n-1]
|
||||
old[n-1] = nil
|
||||
old[n-1] = nil // avoid memory leak
|
||||
*iq = old[0 : n-1]
|
||||
x.idx = -1
|
||||
x.queueId = NoQueue
|
||||
|
Loading…
Reference in New Issue
Block a user