Example #1
0
        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));
        }
Example #2
0
        /// <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));
        }
Example #3
0
 private static extern void GetMemoryInfo(GCMemoryInfoData data, int kind);
Example #4
0
 internal GCMemoryInfo(GCMemoryInfoData data)
 {
     _data = data;
 }