Process Memory Size - Different Counters

前端 未结 7 2016
闹比i
闹比i 2020-12-30 04:46

I\'m trying to find out how much memory my own .Net server process is using (for monitoring and logging purposes).

I\'m using:

Process.GetCurrentProc         


        
7条回答
  •  爱一瞬间的悲伤
    2020-12-30 04:57

    If you want to know how much the GC uses try:

    GC.GetTotalMemory(true)
    

    If you want to know what your process uses from Windows (VM Size column in TaskManager) try:

    Process.GetCurrentProcess().PrivateMemorySize64
    

    If you want to know what your process has in RAM (as opposed to in the pagefile) (Mem Usage column in TaskManager) try:

    Process.GetCurrentProcess().WorkingSet64
    

    See here for more explanation on the different sorts of memory.

提交回复
热议问题