mirror of https://github.com/golang/go.git
runtime: sample large heap allocations correctly
Remove an unnecessary check on the heap sampling code that forced sampling of all heap allocations larger than the sampling rate. This need to follow a poisson process so that they can be correctly unsampled. Maintain a check for MemProfileRate==1 to provide a mechanism for full sampling, as documented in https://golang.org/pkg/runtime/#pkg-variables. Additional testing for this change is on cl/129117. Fixes #26618
This commit is contained in:
parent
0456036e28
commit
d660914ab9
|
|
@ -1012,7 +1012,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||
}
|
||||
|
||||
if rate := MemProfileRate; rate > 0 {
|
||||
if size < uintptr(rate) && int32(size) < c.next_sample {
|
||||
if rate != 1 && int32(size) < c.next_sample {
|
||||
c.next_sample -= int32(size)
|
||||
} else {
|
||||
mp := acquirem()
|
||||
|
|
|
|||
Loading…
Reference in New Issue