Skip to content

runtime/pprof: ReadMemStats before writing heap profile #20565

@josharian

Description

@josharian
$ compilebench -run=Flate -alloc
BenchmarkFlate 1 174337267 ns/op 203717000 user-ns/op 24668880 B/op 238572 allocs/op
$ compilebench -run=Flate -alloc -memprofilerate=128
BenchmarkFlate 1 5448433394 ns/op 5393039000 user-ns/op 153120624 B/op 4721861 allocs/op
$ compilebench -run=Flate -alloc -memprofilerate=256
BenchmarkFlate 1 2914825084 ns/op 2869159000 user-ns/op 109857056 B/op 3202958 allocs/op

The allocs/op numbers should be more or less unchanged by memprofilerate. All that compilebench does is read the Mallocs number printed by the compiler, and the compiler's Mallocs number comes directly from runtime.ReadMemStats.

My simple attempts to reproduce directly using only runtime.ReadMemStats in a simple program have failed, though, and I'm out of time to investigate.

I'd be delighted if anyone reading this was willing to investigate enough to at least rule out a bug in runtime.ReadMemStats.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.SuggestedIssues that may be good for new contributors looking for work to do.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions