Edit

Share via


GC.GetTotalAllocatedBytes(Boolean) Method

Definition

Gets a count of the bytes allocated over the lifetime of the process. The returned value does not include any native allocations.

C#
public static long GetTotalAllocatedBytes(bool precise = false);

Parameters

precise
Boolean

If true, gather a precise number; otherwise, gather an approximate count. Gathering a precise value entails a significant performance penalty.

Returns

The total number of bytes allocated over the lifetime of the process.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10