diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index 7b4b046764..c78005c9af 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -286,15 +286,9 @@ retry: // swept spans are at the end of the list mSpanList_InsertBack(list, s) unlock(&h.lock) + snpages := s.npages if mSpan_Sweep(s, false) { - // TODO(rsc,dvyukov): This is probably wrong. - // It is undercounting the number of pages reclaimed. - // See golang.org/issue/9048. - // Note that if we want to add the true count of s's pages, - // we must record that before calling mSpan_Sweep, - // because if mSpan_Sweep returns true the span has - // been - n++ + n += snpages } lock(&h.lock) if n >= npages {