Skip to content

Commit 24f9b3f

Browse files
authored
Add remarks about GC memory info (dotnet#8445)
1 parent 08c47e4 commit 24f9b3f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

xml/System/GCMemoryInfo.xml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
3131
## Remarks
3232
33-
A garbage collection (GC) is identified by its <xref:System.GCMemoryInfo.Index>, which starts from 1 and increases with each GC. If you are asking for a GC that doesn't exist, for example, you called the <xref:System.GC.GetGCMemoryInfo%2A> method before a GC happened, or you're asking for a GC of <xref:System.GCKind.FullBlocking?displayProperty=nameWithType> and no full blocking GCs have happened, you will get all 0's in the info, including the <xref:System.GCMemoryInfo.Index>. You can use index 0 to detect that no GCs, or no GCs of the kind you specified, have occurred.
33+
A garbage collection (GC) is identified by its <xref:System.GCMemoryInfo.Index>, which starts from 1 and increases with each GC. If you ask for a GC that doesn't exist, you'll get all 0's in the info, including the <xref:System.GCMemoryInfo.Index>. For example, you'll get 0's if you call the <xref:System.GC.GetGCMemoryInfo%2A> method before a GC has happened, or you ask for a GC of <xref:System.GCKind.FullBlocking?displayProperty=nameWithType> and no full blocking GCs have happened. You can use index 0 to detect that no GCs, or no GCs of the kind you specified, have occurred.
3434
3535
]]></format>
3636
</remarks>
@@ -57,7 +57,7 @@ A garbage collection (GC) is identified by its <xref:System.GCMemoryInfo.Index>,
5757
<summary>Gets a value that indicates if this is a compacting GC or not.</summary>
5858
<value>
5959
<see langword="true" /> if this is a compacting GC; <see langword="false" /> otherwise.</value>
60-
<remarks>To be added.</remarks>
60+
<remarks>A compacting GC is when space occupied by dead objects is reclaimed and surviving objects are compacted.</remarks>
6161
</Docs>
6262
</Member>
6363
<Member MemberName="Concurrent">
@@ -82,6 +82,7 @@ A garbage collection (GC) is identified by its <xref:System.GCMemoryInfo.Index>,
8282
<value>
8383
<see langword="true" /> if this is a concurrent GC (background GC); <see langword="false" /> otherwise.</value>
8484
<remarks>To be added.</remarks>
85+
<related type="Article" href="/dotnet/standard/garbage-collection/background-gc">Background garbage collection</related>
8586
</Docs>
8687
</Member>
8788
<Member MemberName="FinalizationPendingCount">
@@ -243,7 +244,7 @@ The memory after `OBJ_D` is not considered part of the `FragmentedBytes` but is
243244
<Docs>
244245
<summary>Gets the high memory load threshold when the last garbage collection occurred.</summary>
245246
<value>The high memory load threshold, in bytes, when the last garbage collection occurred.</value>
246-
<remarks>To be added.</remarks>
247+
<remarks>Most of the GC performance heuristics are based on per-process measurements. However, to avoid paging, GC is aware of the global physical memory load on the machine or VM or in the container. GC recognizes a certain memory load percentage as a "high memory load situation". When the memory load percentage is over that threshold, GC becomes more aggressive and will do more full blocking GCs if necessary to reduce the heap size.</remarks>
247248
</Docs>
248249
</Member>
249250
<Member MemberName="Index">
@@ -264,10 +265,10 @@ The memory after `OBJ_D` is not considered part of the `FragmentedBytes` but is
264265
<ReturnType>System.Int64</ReturnType>
265266
</ReturnValue>
266267
<Docs>
267-
<summary>Gets the index of this GC. GC indices start with 1 and are increased at the beginning of a GC.
268-
Since the information is updated at the end of a GC, this means you can get the information for a background GC with a smaller index than a foreground GC that finished earlier.</summary>
268+
<summary>Gets the index of this GC.</summary>
269269
<value>The index of this GC.</value>
270-
<remarks>To be added.</remarks>
270+
<remarks>GC indices start with 1 and are increased at the beginning of a GC.
271+
Since the information is updated at the end of a GC, this means you can get the information for a background GC with a smaller index than a foreground GC that finished earlier.</remarks>
271272
</Docs>
272273
</Member>
273274
<Member MemberName="MemoryLoadBytes">
@@ -292,7 +293,8 @@ The memory after `OBJ_D` is not considered part of the `FragmentedBytes` but is
292293
<Docs>
293294
<summary>Gets the physical memory load when the last garbage collection occurred.</summary>
294295
<value>The physical memory load, in bytes, when the last garbage collection occurred.</value>
295-
<remarks>Data is only brought into physical memory on first touch. If you allocated a big object but haven't actually used it, most of its memory isn't in physical memory. In this case, the allocation won't affect the memory load significantly.</remarks>
296+
<remarks><para>On Windows, memory load is a field in the [MEMORYSTATUS structure](/windows/win32/api/winbase/ns-winbase-memorystatus). It's a number between 0 and 100 that specifies the approximate percentage of physical memory that's in use (0 indicates no memory use and 100 indicates full memory use). Corresponding information is given on other operating systems.</para>
297+
<para>Data is only brought into physical memory on first touch. If you allocated a big object but haven't actually used it, most of its memory isn't in physical memory. In this case, the allocation won't affect the memory load significantly.</para></remarks>
296298
</Docs>
297299
</Member>
298300
<Member MemberName="PauseDurations">
@@ -313,9 +315,9 @@ The memory after `OBJ_D` is not considered part of the `FragmentedBytes` but is
313315
<ReturnType>System.ReadOnlySpan&lt;System.TimeSpan&gt;</ReturnType>
314316
</ReturnValue>
315317
<Docs>
316-
<summary>Gets the pause durations. For blocking GCs, there is one pause; for background GC, there are two.</summary>
318+
<summary>Gets the durations of the pauses when all managed threads are suspended.</summary>
317319
<value>A timespan representing the pause durations.</value>
318-
<remarks>To be added.</remarks>
320+
<remarks> For blocking GCs, there is one pause. Pauses for background GC are illustrated at [Background workstation vs. server GC](/dotnet/standard/garbage-collection/background-gc#background-workstation-vs-server-gc).</remarks>
319321
</Docs>
320322
</Member>
321323
<Member MemberName="PauseTimePercentage">
@@ -384,7 +386,7 @@ The memory after `OBJ_D` is not considered part of the `FragmentedBytes` but is
384386
<Docs>
385387
<summary>Gets the promoted bytes for this GC.</summary>
386388
<value>The number of promoted bytes for this GC.</value>
387-
<remarks>To be added.</remarks>
389+
<remarks>The promoted bytes represent the objects from the generations that the garbage collection is collecting that survived.</remarks>
388390
</Docs>
389391
</Member>
390392
<Member MemberName="TotalAvailableMemoryBytes">
@@ -444,7 +446,7 @@ Otherwise, the value of the property is the physical memory on the machine that
444446
<Docs>
445447
<summary>Gets the total committed bytes of the managed heap.</summary>
446448
<value>The total committed bytes of the managed heap.</value>
447-
<remarks>To be added.</remarks>
449+
<remarks>The total committed bytes is the amount of backing store for the memory. On Windows, bytes are committed when `VirtualAlloc` is called with `MEM_COMMIT`. On Linux, bytes are committed when the page mapping is changed to <code>PROT_WRITE | PROT_READ</code>.</remarks>
448450
</Docs>
449451
</Member>
450452
</Members>

0 commit comments

Comments
 (0)