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. 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:
Run in app-domain and use App domain resource monitoring
Run in separate process and use properties on : System.Diagnostics.Process (for the running process).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With