GC.GetTotalMemory
retrieves the amount of memory that is supposed to be allocated. It only knows about the memory allocated by managed components, unless you name GC.AddMemoryPressure
to talk about another allocated memory.
You can better understand the real amount of memory allocated by reading Process.WorkingSet64
, Process.VirtualMemory64
and other such properties of the Process
class. Just call Process.GetCurrentProcess
and then get what you need.
However, you are probably better off using performance counters.
source share