@@ -103,27 +103,35 @@ <h2 id="runtime">Runtime</h2>
103
103
104
104
< p > <!-- https://go.dev/issue/48409 --> <!-- CL 397018 -->
105
105
The runtime now includes support for a soft memory limit. This memory limit
106
- includes all memory mapped and managed by the runtime, and excludes external
107
- memory sources such as binary size, memory managed in other languages, and
108
- memory held by the operating system on behalf of the Go program. This limit
109
- may be managed via the < code > GOMEMLIMIT</ code > environment variable or the
110
- < code > SetMemoryLimit</ code > function in the runtime/debug package. The limit
111
- works in conjunction with < code > GOGC</ code > and < code > SetGCPercent</ code > ,
106
+ includes the Go heap and all other memory managed by the runtime, and
107
+ excludes external memory sources such as mappings of the binary itself,
108
+ memory managed in other languages, and memory held by the operating system on
109
+ behalf of the Go program. This limit may be managed via
110
+ < a href ="/pkg/runtime/debug/#SetMemoryLimit "> < code > runtime/debug.SetMemoryLimit</ code > </ a >
111
+ or the equivalent
112
+ < a href ="/pkg/runtime/#hdr-Environment_Variables "> < code > GOMEMLIMIT</ code > </ a >
113
+ environment variable. The limit works in conjunction with
114
+ < a href ="/pkg/runtime/debug/#SetGCPercent "> < code > runtime/debug.SetGCPercent</ code > </ a >
115
+ / < a href ="/pkg/runtime/#hdr-Environment_Variables "> < code > GOGC</ code > </ a > ,
112
116
and will be respected even if < code > GOGC=off</ code > , allowing Go programs to
113
117
always make maximal use of their memory limit, improving resource efficiency
114
- in some cases. Please note that small memory limits, on the order of tens of
115
- megabytes or less, are less likely to be adhered to due to external latency
116
- factors, such as OS scheduling. See https://go.dev/issue/52433 for more
117
- details. Larger memory limits, on the order of hundreds of megabytes or more,
118
- are stable and production-ready.
118
+ in some cases. See < a href ="https://go.dev/doc/gc-guide "> the GC guide</ a > for
119
+ a detailed guide explaining the soft memory limit in more detail, as well as
120
+ a variety of common use-cases and scenarios. Please note that small memory
121
+ limits, on the order of tens of megabytes or less, are less likely to be
122
+ respected due to external latency factors, such as OS scheduling. See
123
+ < a href ="https://go.dev/issue/52433 "> issue 52433</ a > for more details. Larger
124
+ memory limits, on the order of hundreds of megabytes or more, are stable and
125
+ production-ready.
119
126
</ p >
120
127
121
128
< p > <!-- CL 353989 -->
122
129
In order to limit the effects of GC thrashing when the program's live heap
123
130
size approaches the soft memory limit, the Go runtime also attempts to limit
124
131
total GC CPU utilization to 50%, excluding idle time, choosing to use more
125
132
memory over preventing application progress. In practice, we expect this limit
126
- to only play a role in exceptional cases, and the new runtime/metrics metric
133
+ to only play a role in exceptional cases, and the new
134
+ < a href ="/pkg/runtime/metrics/#hdr-Supported_metrics "> runtime metric</ a >
127
135
< code > /gc/limiter/last-enabled:gc-cycle</ code > reports when this last
128
136
occurred.
129
137
</ p >
@@ -667,20 +675,27 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
667
675
< dl id ="runtime/metrics "> < dt > < a href ="/pkg/runtime/metrics/ "> runtime/metrics</ a > </ dt >
668
676
< dd >
669
677
< p > <!-- https://go.dev/issue/47216 --> <!-- CL 404305 -->
670
- The new < code > /sched/gomaxprocs:threads</ code > metric reports the current
671
- < code > runtime.GOMAXPROCS</ code > value.
678
+ The new < code > /sched/gomaxprocs:threads</ code >
679
+ < a href ="/pkg/runtime/metrics/#hdr-Supported_metrics "> metric</ a > reports
680
+ the current
681
+ < a href ="/pkg/runtime/#GOMAXPROCS "> < code > runtime.GOMAXPROCS</ code > </ a >
682
+ value.
672
683
</ p >
673
684
674
685
< p > <!-- https://go.dev/issue/47216 --> <!-- CL 404306 -->
675
- The new < code > /cgo/go-to-c-calls:calls</ code > metric reports the total
676
- number of calls made from Go to C. This metric is identical to the < a
677
- href ="/pkg/runtime/#NumCgoCall "> < code > runtime.NumCgoCall</ code > </ a >
686
+ The new < code > /cgo/go-to-c-calls:calls</ code >
687
+ < a href ="/pkg/runtime/metrics/#hdr-Supported_metrics "> metric</ a >
688
+ reports the total number of calls made from Go to C. This metric is
689
+ identical to the
690
+ < a href ="/pkg/runtime/#NumCgoCall "> < code > runtime.NumCgoCall</ code > </ a >
678
691
function.
679
692
</ p >
680
693
681
694
< p > <!-- https://go.dev/issue/48409 --> <!-- CL 403614 -->
682
- The new < code > /gc/limiter/last-enabled:gc-cycle</ code > metric reports the
683
- last GC cycle when the GC CPU limiter was enabled.
695
+ The new < code > /gc/limiter/last-enabled:gc-cycle</ code >
696
+ < a href ="/pkg/runtime/metrics/#hdr-Supported_metrics "> metric</ a >
697
+ reports the last GC cycle when the GC CPU limiter was enabled. See the
698
+ < a href ="#runtime "> runtime notes</ a > for details about the GC CPU limiter.
684
699
</ p >
685
700
</ dd >
686
701
</ dl > <!-- runtime/metrics -->
0 commit comments