Skip to content

Commit

Permalink
fix(waiterHeap): Zero-out popped slice slots
Browse files Browse the repository at this point in the history
Avoids memory leaks because the waiter holds a function reference.
  • Loading branch information
abhinav committed Sep 8, 2023
1 parent 8b81867 commit dee5232
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/ztest/clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (h *waiterHeap) Pop() interface{} {
old := *h
n := len(old)
x := old[n-1]
old[n-1] = waiter{} // avoid memory leak
*h = old[:n-1]
return x
}

0 comments on commit dee5232

Please sign in to comment.