diff options
author | Michael Anthony Knyszek <mknyszek@google.com> | 2023-11-15 21:05:02 +0000 |
---|---|---|
committer | Michael Knyszek <mknyszek@google.com> | 2023-11-16 05:48:00 +0000 |
commit | 0011342590391655bd0cd732cf89c385c30c1278 (patch) | |
tree | 97c84f0ce16d33cf1ef8cf7d20506a0bc6be25ba /test | |
parent | 22278e3835b15fee7057d4bfa5ec717c65e9cc82 (diff) | |
download | go-0011342590391655bd0cd732cf89c385c30c1278.tar.gz go-0011342590391655bd0cd732cf89c385c30c1278.zip |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/finprofiled.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/finprofiled.go b/test/finprofiled.go index ca7e3c81dc..ef8f61c802 100644 --- a/test/finprofiled.go +++ b/test/finprofiled.go @@ -57,6 +57,11 @@ func main() { for _, p := range prof { bytes := p.AllocBytes - p.FreeBytes 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 if size == tinyBlockSize { totalBytes += bytes |