开发者

Getting the Memory statistics for a thread in C#

开发者 https://www.devze.com 2023-03-17 17:20 出处:网络
I\'d just like to ask if there\'s a way to get the memory statistics of a thread (i.e. Working Set, Private Memory, etc.).I know that we can obtain those for a Process, but my app needs to run a set o

I'd just like to ask if there's a way to get the memory statistics of a thread (i.e. Working Set, Private Memory, etc.). I know that we can obtain those for a Process, but my app needs to run a set of tests and for each test, I need to get the stats, especially the Peak Memory. 开发者_如何学JAVA Right now the only way I do this is run the app for each test and get the Peak Memory of the process.

Is there perhaps a way to get thread-level memory stats?

Thanks.


Threads don't have memory statistics.

Heap memory is not associated with any single thread.
The information you're looking for does not make sense.


As the other responders suggest, you cannot get memory stats on a by-thread basis. Your best bet would be to either:

  1. Run in app-domain and use App domain resource monitoring

  2. Run in separate process and use properties on : System.Diagnostics.Process (for the running process).

0

精彩评论

暂无评论...
验证码 换一张
取 消