mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 01:27:38 +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
|
old := *bp
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
old[n-1] = PeerRef{}
|
old[n-1] = PeerRef{} // avoid memory leak
|
||||||
*bp = old[0 : n-1]
|
*bp = old[0 : n-1]
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ func (s *TxByPriceAndTime) Pop() interface{} {
|
|||||||
old := *s
|
old := *s
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
old[n-1] = nil
|
old[n-1] = nil // avoid memory leak
|
||||||
*s = old[0 : n-1]
|
*s = old[0 : n-1]
|
||||||
return x
|
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.
|
// Shift replaces the current best head with the next one from the same account.
|
||||||
func (t *TransactionsFixedOrder) Shift() {
|
func (t *TransactionsFixedOrder) Shift() {
|
||||||
|
t.Transactions[0] = nil // avoid memory leak
|
||||||
t.Transactions = t.Transactions[1:]
|
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
|
// 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.
|
// and hence all subsequent ones should be discarded from the same account.
|
||||||
func (t *TransactionsFixedOrder) Pop() {
|
func (t *TransactionsFixedOrder) Pop() {
|
||||||
|
t.Transactions[0] = nil // avoid memory leak
|
||||||
t.Transactions = t.Transactions[1:]
|
t.Transactions = t.Transactions[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ func (t *transactionsByGasPrice) Pop() interface{} {
|
|||||||
old := t.txs
|
old := t.txs
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
old[n-1] = nil
|
old[n-1] = nil // avoid memory leak
|
||||||
t.txs = old[0 : n-1]
|
t.txs = old[0 : n-1]
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ func (s *sortingHeap) Pop() interface{} {
|
|||||||
old := *s
|
old := *s
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
old[n-1] = nil
|
old[n-1] = nil // avoid memory leak
|
||||||
*s = old[0 : n-1]
|
*s = old[0 : n-1]
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ func (iq *InsertQueue) Pop() interface{} {
|
|||||||
old := *iq
|
old := *iq
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
old[n-1] = nil
|
old[n-1] = nil // avoid memory leak
|
||||||
*iq = old[0 : n-1]
|
*iq = old[0 : n-1]
|
||||||
x.idx = -1
|
x.idx = -1
|
||||||
x.queueId = NoQueue
|
x.queueId = NoQueue
|
||||||
|
Loading…
Reference in New Issue
Block a user