Measuring memory consumption of a thread

How do you measure the memory consumption of a thread in C#?

The scenario I'm looking at is that a program is trying to solve some hard search problems, it kicks off a thread to look for a solution to one of them, the thread runs for a while, maybe it finds a solution, or maybe it runs over its memory allowance and therefore fails. But to implement that, it's necessary to find out how much memory the thread (as opposed to the entire process) is using. Is there a way to do that?


Threads share a common heap, but have their own stack.

Rather than trying to obtain the memory consumption for a particular thread(you cant do) you would be better off profiling your solution using Visual Studio Memory Profiler or use Ants Memory profiler to help find potential memory issues you're facing.

Does your application spit out any exceptions?

链接地址: http://www.djcxy.com/p/35060.html

上一篇: 使用delphi SuperObject将MySQL DataSet转换为Json格式

下一篇: 测量线程的内存消耗