Skip to content

Commit 6120688

Browse files
codesoapRobert Griesemer
authored and
Robert Griesemer
committed
container/heap: remove confusing claim of memory leak
The term "memory leak" was misused here, as the memory is still referenced by the slice. Fixes #65403 Change-Id: Id102419d4c798fb2a4ec8be86be9ec9b5cdd98e6 GitHub-Last-Rev: 3febcd0 GitHub-Pull-Request: #65404 Reviewed-on: https://go-review.googlesource.com/c/go/+/559775 Auto-Submit: Keith Randall <[email protected]> Reviewed-by: Mauri de Souza Meneguzzo <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Reviewed-by: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent a5fb656 commit 6120688

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/container/heap/example_pq_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (pq *PriorityQueue) Pop() any {
4545
old := *pq
4646
n := len(old)
4747
item := old[n-1]
48-
old[n-1] = nil // avoid memory leak
48+
old[n-1] = nil // don't stop the GC from reclaiming the item eventually
4949
item.index = -1 // for safety
5050
*pq = old[0 : n-1]
5151
return item

0 commit comments

Comments
 (0)