public static GCMemoryInfo GetGCMemoryInfo() { var data = new GCMemoryInfoData(); _GetGCMemoryInfo(out data._highMemoryLoadThresholdBytes, out data._memoryLoadBytes, out data._totalAvailableMemoryBytes, out data._heapSizeBytes, out data._fragmentedBytes); return(new GCMemoryInfo(data)); }
/// <summary>Gets garbage collection memory information.</summary> /// <param name="kind">The kind of collection for which to retrieve memory information.</param> /// <returns>An object that contains information about the garbage collector's memory usage.</returns> public static GCMemoryInfo GetGCMemoryInfo(GCKind kind) { if ((kind < GCKind.Any) || (kind > GCKind.Background)) { throw new ArgumentOutOfRangeException(nameof(kind), SR.Format( SR.ArgumentOutOfRange_Bounds_Lower_Upper, GCKind.Any, GCKind.Background)); } var data = new GCMemoryInfoData(); GetMemoryInfo(data, (int)kind); return(new GCMemoryInfo(data)); }
private static extern void GetMemoryInfo(GCMemoryInfoData data, int kind);
internal GCMemoryInfo(GCMemoryInfoData data) { _data = data; }