0

I'm still not able to get the memory consumption of a process (usually the current process) exactly as shown in Task Manager. I've already tried several values supplied in System.Diagnostics.Process and some performance counters. Is there some direct way to do that or is it neccesary to add up some values?

nepa
  • 1,421
  • 2
  • 18
  • 28
  • Task manager can display a number of different memory values for each process (look at View | Select Columns): which one do you want? – Richard Nov 01 '11 at 09:03

2 Answers2

2

Why do want the memory values of task manager? Probably this value is not exactly what you think.

Look at this post for a good overview about memory in .net.

A good overview about memory in general, you find here. Check the also links on the top of the post.

If you have a memory problem, the look here. The video has an interesting part about memory profiling, not only valid for WPF.

Community
  • 1
  • 1
HCL
  • 36,053
  • 27
  • 163
  • 213
  • If you have a memory problem start by reading *[Windows Internals](http://www.amazon.co.uk/Windows-Internals-6th-Mark-Russinovich/dp/0735648735/ref=sr_1_sc_1?ie=UTF8&qid=1320138292&sr=8-1-spell)* (or watching Mark Russinovich's two parter from PDC10: [One](http://channel9.msdn.com/Events/PDC/PDC10/CD01), [Two](http://channel9.msdn.com/Events/PDC/PDC10/CD02)). – Richard Nov 01 '11 at 09:07
  • That's maybe a good starting point. A memory profiler shows me a considerable amount of "unidentified memory" which also Diagnostics.Process does not recignize ... in my special case. – nepa Nov 01 '11 at 17:16
1

To get the total virtual memory use Process.VirtualMemorySize64. And for more information on the memory usage of the process check MSDN here: How to: Investigate Memory Usage for Processes

Sascha Hennig
  • 2,556
  • 1
  • 19
  • 22