Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine how much memory my .NET program is using?

It seems to be often said that Task Manager does not provide an accurate indication of how much memory is in use by a process.

If this is indeed the case, what's the easiest way to find these things out?

I'd like to know:

  • Total Memory in use (whether in RAM or paged or whatever)
  • Total RAM in use (running in a situation where the machine has loads of free physical RAM so things getting forcibly paged out hopefully isn't an issue)
  • Total Memory actually used by the program (not counting the extra overhead the GC keeps around)
  • Total Memory usage that is solely used by my program (not counting shared libraries/shared memory)
  • Total Shared memory usage.
like image 712
Orion Edwards Avatar asked Dec 10 '08 21:12

Orion Edwards


2 Answers

Grab Process Explorer, right-click -> Properties the process in the list, and then click the ".NET" tab. Select ".NET CLR Memory" from the combobox, and you'll have more live info about your process than you'll know what to do with ;)

like image 53
moobaa Avatar answered Sep 20 '22 14:09

moobaa


http://memprofiler.com/ is a very good .Net memory profiler. But Microsoft's build into Windows Performance Monitor (perfmon) will also give you those figures. See http://dotnetdebug.net/2005/06/30/perfmon-your-debugging-buddy/ for that.

like image 31
Lars Truijens Avatar answered Sep 19 '22 14:09

Lars Truijens