Move GCMemoryInfo to shared partition
[mono-project.git] / netcore / System.Private.CoreLib / shared / System / GCMemoryInfo.cs
blob72c2aca14da2360e8d2a33b56863d910fc70a98c
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 namespace System
7 public readonly struct GCMemoryInfo
9 /// <summary>
10 /// High memory load threshold when the last GC occured
11 /// </summary>
12 public long HighMemoryLoadThresholdBytes { get; }
14 /// <summary>
15 /// Memory load when the last GC ocurred
16 /// </summary>
17 public long MemoryLoadBytes { get; }
19 /// <summary>
20 /// Total available memory for the GC to use when the last GC ocurred. By default this is the physical memory on the machine, but it may be customized by specifying a HardLimit.
21 /// </summary>
22 public long TotalAvailableMemoryBytes { get; }
24 /// <summary>
25 /// The total heap size when the last GC ocurred
26 /// </summary>
27 public long HeapSizeBytes { get; }
29 /// <summary>
30 /// The total fragmentation when the last GC ocurred
31 ///
32 /// Let's take the example below:
33 /// | OBJ_A | OBJ_B | OBJ_C | OBJ_D | OBJ_E |
34 ///
35 /// Let's say OBJ_B, OBJ_C and and OBJ_E are garbage and get collected, but the heap does not get compacted, the resulting heap will look like the following:
36 /// | OBJ_A | F | OBJ_D |
37 ///
38 /// The memory between OBJ_A and OBJ_D marked `F` is considered part of the FragmentedBytes, and will be used to allocate new objects. The memory after OBJ_D will not be
39 /// considered part of the FragmentedBytes, and will also be used to allocate new objects
40 /// </summary>
41 public long FragmentedBytes { get; }
43 internal GCMemoryInfo(long highMemoryLoadThresholdBytes,
44 long memoryLoadBytes,
45 long totalAvailableMemoryBytes,
46 long heapSizeBytes,
47 long fragmentedBytes)
49 HighMemoryLoadThresholdBytes = highMemoryLoadThresholdBytes;
50 MemoryLoadBytes = memoryLoadBytes;
51 TotalAvailableMemoryBytes = totalAvailableMemoryBytes;
52 HeapSizeBytes = heapSizeBytes;
53 FragmentedBytes = fragmentedBytes;