My coworkers and I are trying to track a memory issue in an application, and in my research I found a blog entry that talks about how each thread gets a 1MB stack by default. Our application happens to create a lot of threads, and so we wrote a quick test program to make sure we understood exactly what was happening. The test app (C#) just goes and creates 300 threads, but Task Manager still only showed 22MB of memory. Is stack memory not counted by Task Manager, or is something else going on?
+1
A:
Task Manager is not the best tool for memory consumtion determination. Instead, download the free trial of a tool like MemProfiler, or RedGate's Memory Profiler
Don’t use the mem usage column in Task Manager for diagnostics or profiling. Use the Perfmon counters, especially Private Bytes and the specific .NET counters that will reveal problems like memory leaks.
Might also be of interest: Memory Usage Auditing For .NET Applications
Mitch Wheat
2009-08-05 13:49:56
Yes I realize this - it's one of the most overstated things about .NET memory. However, it doesn't answer my question at all. The question is simply - is Stack Memory reported as "memory in use" by Task Manager?
Michael Bray
2009-08-05 14:33:38
The "Task Manager" is an application of the MicroSoft advertising team to prove that "Windows is not slow, you must be imagining things" ;)
Aaron Digulla
2009-08-05 14:34:07
@Michael Bray: your question is moot. Use a better tool for the task at hand.
Mitch Wheat
2009-08-05 14:43:01
What about non-.NET applications?
Chris Burt-Brown
2009-08-05 14:49:48