Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Fix evictedQueue memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Miao committed Mar 24, 2020
1 parent 84d38db commit 475672b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion trace/evictedqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ func newEvictedQueue(capacity int) *evictedQueue {

func (eq *evictedQueue) add(value interface{}) {
if len(eq.queue) == eq.capacity {
eq.queue = eq.queue[1:]
newQueue := make([]interface{}, eq.capacity-1, eq.capacity)
copy(newQueue, eq.queue[1:])
eq.queue = newQueue
eq.droppedCount++
}
eq.queue = append(eq.queue, value)
Expand Down

0 comments on commit 475672b

Please sign in to comment.