]> Cypherpunks repositories - gostls13.git/commit
runtime: remove intermediate fields in memstats for ReadMemStats
authorMichael Anthony Knyszek <mknyszek@google.com>
Mon, 14 Mar 2022 23:39:03 +0000 (23:39 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 31 Mar 2022 20:02:31 +0000 (20:02 +0000)
commit4a56ba1c453927256f231a8bcef316bb4b3aa68a
treeb8df0e033975a1666d187d0d95547ffb8883b819
parent3334afd7609185574ad179cb030064f0825c2101
runtime: remove intermediate fields in memstats for ReadMemStats

Currently, the ReadMemStats (really this is all happening in
readmemstats_m, but that's just a direct call from ReadMemStats) call
chain first populates some fields in memstats, then copies those into
the final MemStats location. This used to make a lot of sense when
memstats' structure aligned with MemStats, and the values were just
copied from one to other. Sometime in the last few releases, we switched
to populating the MemStats manually because a lot of fields had diverged
from their internal representation. Now, we're left with a lot of fields
in memstats that pollute the structure: they only exist to be updated
for the sake of ReadMemStats. Since we're going to be adding more fields
to memstats in further CLs, this is a good opportunity to clean up.

As a result of this change, updatememstats, which used to just update
the aforementioned intermediate fields in memstats, is no longer
necessary, so it is removed.

Change-Id: Ifabfb3ac3002641105af62e9509a6351165dcd87
Reviewed-on: https://go-review.googlesource.com/c/go/+/393397
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/heapdump.go
src/runtime/malloc.go
src/runtime/mstats.go