What's the best tool to track a process's memory usage over a long period of time in Windows?

后端 未结 7 1154
北海茫月
北海茫月 2021-01-16 07:17

What is the best available tool to monitor the memory usage of my C#/.Net windows service over a long period of time. As far as I know, tools like perfmon can monitor the m

相关标签:
7条回答
  • 2021-01-16 07:28

    I've used ProcessMonitor if you need something more powerful than perfmon.

    0 讨论(0)
  • 2021-01-16 07:42

    If you're familiar with Python, it's pretty easy to write a script for this.

    Activestate Python (which is free) exposes the relevant parts of the Win32 API through the win32process module.

    You can also check out all win32 related modules or use gotAPI to browse the Python standard libs.

    0 讨论(0)
  • 2021-01-16 07:44

    Perfmon in my opinion is one of the best tools to do this but make sure you properly configure the sampling interval according to the time you wish to monitor.

    For example if you want to monitor a process:

    • for 1 hour : I would use 1 second intervals (this will generate 60*60 samples)
    • for 1 day : I would use 30 second intervals (this will generate 2*60*24 samples)
    • for 1 week : I would use 1 minute intervals (this will generate 60*24*7 samples)

    With these sampling intervals Perfmon should have no problem generating a nice graphical output of your counters.

    0 讨论(0)
  • 2021-01-16 07:46

    I would recommend using the .Net Memory Validator tool from software verify. This tool helped me to solve many different issues related to memory management in .Net application I have to work with.

    I use more frequently the C++ version but they are quite similar and the fact that you can really see in real-time the type of the objects being allocated will be invaluable to you.

    0 讨论(0)
  • 2021-01-16 07:49

    As good as monitoring the memory is by itself, you're probably thinking of memory profiling to identify leaks or stale objects - http://memprofiler.com/ is a good choice here, but there are plenty of others.

    If you want to do something very specific, don't be afraid to write your own WMI-based logger running on a timer - you could get this to email you process statistics, warn when it grows too fast or too high, send it as XML for charting, etc.

    0 讨论(0)
  • 2021-01-16 07:51

    Playing around with Computer Management (assuming you're running Windows here) and it seems like you can make it monitor a process over time. Go to computer management -> performance logs and alerts and look at the counter/trace logs. Right click on counter logs and add a new log. Now click add object and select memory. Now click add counters and change the "Performance Object" to Process, and select your process.

    0 讨论(0)
提交回复
热议问题