mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
test: ignore MemProfileRecords with no live objects in finprofiled.go
This test erroneously assumes that there will always be at least one live object accounted for in a MemProfileRecord. This is not true; all memory allocated from a particular location could be dead. Fixes #64153. Change-Id: Iadb783ea9b247823439ddc74b62a4c8b2ce8e33e Reviewed-on: https://go-review.googlesource.com/c/go/+/542736 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
22278e3835
commit
0011342590
@ -57,6 +57,11 @@ func main() {
|
|||||||
for _, p := range prof {
|
for _, p := range prof {
|
||||||
bytes := p.AllocBytes - p.FreeBytes
|
bytes := p.AllocBytes - p.FreeBytes
|
||||||
nobj := p.AllocObjects - p.FreeObjects
|
nobj := p.AllocObjects - p.FreeObjects
|
||||||
|
if nobj == 0 {
|
||||||
|
// There may be a record that has had all of its objects
|
||||||
|
// freed. That's fine. Avoid a divide-by-zero and skip.
|
||||||
|
continue
|
||||||
|
}
|
||||||
size := bytes / nobj
|
size := bytes / nobj
|
||||||
if size == tinyBlockSize {
|
if size == tinyBlockSize {
|
||||||
totalBytes += bytes
|
totalBytes += bytes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user