diff options
author | Than McIntosh <thanm@google.com> | 2023-07-07 16:49:15 -0400 |
---|---|---|
committer | Than McIntosh <thanm@google.com> | 2023-07-07 16:49:15 -0400 |
commit | 71aaa8bde1ba983894121987aaf09cb2012ab622 (patch) | |
tree | 12c26e401a50654e0d557b98b2136b18b5ee9d97 /src/runtime/mstats.go | |
parent | 3aba453b66371647dfad4e901fca578d2b564e09 (diff) | |
parent | 894d24d617bb72d6e1bed7b143f9f7a0ac16b844 (diff) | |
download | go-71aaa8bde1ba983894121987aaf09cb2012ab622.tar.gz go-71aaa8bde1ba983894121987aaf09cb2012ab622.zip |
[dev.inline] merge with master at 894d24d617dev.inline
Change-Id: I845eec08108c69228ebcba921f8a807a376d3fae
Diffstat (limited to 'src/runtime/mstats.go')
-rw-r--r-- | src/runtime/mstats.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go index ab383dd8e3..9cdc565137 100644 --- a/src/runtime/mstats.go +++ b/src/runtime/mstats.go @@ -199,7 +199,17 @@ type MemStats struct { // StackSys is bytes of stack memory obtained from the OS. // // StackSys is StackInuse, plus any memory obtained directly - // from the OS for OS thread stacks (which should be minimal). + // from the OS for OS thread stacks. + // + // In non-cgo programs this metric is currently equal to StackInuse + // (but this should not be relied upon, and the value may change in + // the future). + // + // In cgo programs this metric includes OS thread stacks allocated + // directly from the OS. Currently, this only accounts for one stack in + // c-shared and c-archive build modes and other sources of stacks from + // the OS (notably, any allocated by C code) are not currently measured. + // Note this too may change in the future. StackSys uint64 // Off-heap memory statistics. @@ -347,6 +357,7 @@ func init() { // which is a snapshot as of the most recently completed garbage // collection cycle. func ReadMemStats(m *MemStats) { + _ = m.Alloc // nil check test before we switch stacks, see issue 61158 stopTheWorld(stwReadMemStats) systemstack(func() { |