You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When check if it can return the busy list using "len(free)", I think it's not proper.
Although the current version of Go set the same lenght of h.free and h.busy, it's different.
The same puzzle occurs at the definition of mheap.alloc_m @ mheap.go:592:
if large {
memstats.heap_objects++
atomic.Xadd64(&memstats.heap_live, int64(npage<<_PageShift))
// Swept spans are at the end of lists.
if s.npages < uintptr(len(h.free)) {
h.busy[s.npages].insertBack(s)
} else {
h.busylarge.insertBack(s)
}
}
So it's a mistake, or it's some design.
The text was updated successfully, but these errors were encountered:
This is a little obtuse, but I wouldn't call it a bug. The free and busy lists must have the same length since we move short spans back and forth between these two lists.
It would be perfectly reasonable to change both of these to len(h.busy).
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.7.4
What operating system and processor architecture are you using (
go env
)?linux amd64
The definition of mheap.busyList locate in mheap.go:943 as followed:
func (h *mheap) busyList(npages uintptr) *mSpanList {
if npages < uintptr(len(h.free)) {
return &h.busy[npages]
}
return &h.busylarge
}
When check if it can return the busy list using "len(free)", I think it's not proper.
Although the current version of Go set the same lenght of h.free and h.busy, it's different.
The same puzzle occurs at the definition of mheap.alloc_m @ mheap.go:592:
if large {
memstats.heap_objects++
atomic.Xadd64(&memstats.heap_live, int64(npage<<_PageShift))
// Swept spans are at the end of lists.
if s.npages < uintptr(len(h.free)) {
h.busy[s.npages].insertBack(s)
} else {
h.busylarge.insertBack(s)
}
}
So it's a mistake, or it's some design.
The text was updated successfully, but these errors were encountered: