How can I determine how much memory my .NET progra

2019-06-18 05:21发布

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.

7条回答
Luminary・发光体
2楼-- · 2019-06-18 06:07

Process Explorer will show you some of this if you double-click on on a process.

查看更多
够拽才男人
3楼-- · 2019-06-18 06:08

Start Performance Monitor (perfmon.exe) and take a look at the .Net CLR Memory performance object. Every running .net program has its own instance. You should be able to find what you want there.

查看更多
淡お忘
4楼-- · 2019-06-18 06:08

There are some good features in the SysInternals ProcessExplorer including a .NET profiler, though ANTS is the way to go if you need a pro tool.

查看更多
Explosion°爆炸
5楼-- · 2019-06-18 06:18

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.

查看更多
叼着烟拽天下
6楼-- · 2019-06-18 06:21

I use memprofiler as well and it helped us out tremendously.

查看更多
做自己的国王
7楼-- · 2019-06-18 06:23

There are some things you can do but I believe the best thing out there, if you're serious about profiling your application, is to use the Ants Profiler by Red Gate:

http://www.red-gate.com/Products/ants_profiler/index.htm

This software is really comprehensive and will give a good picture what sorts of memory usage and other sorts of metrics your app presents.

查看更多
登录 后发表回答