Inward_Spiral
asked on
Can I determine my .NET application's memory usage without Perfmon?
Hello all,
I've been using Perfmon for quite some time, and have gotten pretty experienced in gathering data from it.
However, I have found at least one instance where Perfmon doesn't tell me what I need to know:
We develop a large number of ASP.NET applications, and since they can all run under the same IIS instance (w3wp.exe), it is difficult to tell how much memory each of them is using because it all shows up under the same category!
Currently, the only way I can tell how much memory any of the applications are using by themselves is to put one application into a separate application pool all by itself. Unfortunately, this doesn't work too well on a large scale, because we have dozens of web applications each installed on dozens of client locations.
If I could find a way for each ASP.NET application to write out how much physical memory it is using at any point in time, it would make it a lot easier to tell what applications are the "heavy" ones.
So...can I do it? Can an ASP.NET application tell me how much memory it is using by itself, without telling me how much memory the entire application pool is using?
Comments/suggestions are definitely welcome!
Thanks!
I've been using Perfmon for quite some time, and have gotten pretty experienced in gathering data from it.
However, I have found at least one instance where Perfmon doesn't tell me what I need to know:
We develop a large number of ASP.NET applications, and since they can all run under the same IIS instance (w3wp.exe), it is difficult to tell how much memory each of them is using because it all shows up under the same category!
Currently, the only way I can tell how much memory any of the applications are using by themselves is to put one application into a separate application pool all by itself. Unfortunately, this doesn't work too well on a large scale, because we have dozens of web applications each installed on dozens of client locations.
If I could find a way for each ASP.NET application to write out how much physical memory it is using at any point in time, it would make it a lot easier to tell what applications are the "heavy" ones.
So...can I do it? Can an ASP.NET application tell me how much memory it is using by itself, without telling me how much memory the entire application pool is using?
Comments/suggestions are definitely welcome!
Thanks!
If you just want to know how many bytes are allocated in the managed memory heap try GC.GetTotalMemory. You might want to force a garbage collection, otherwise this will include unreferenced objects that have yet to be freed.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.