线程本地存储内存使用情况
.NET 中有没有办法确定线程本地存储占用的内存量?
具体来说,我希望找到 ThreadStatic 对象使用的内存量以及分配给线程数据槽中对象的内存量(例如通过调用 Thread.SetData)。
澄清一下:
线程本地存储: http://msdn.microsoft.com/en-us/library/6sby1byh.aspx
线程本地存储:线程相关静态字段和数据槽 http://msdn.microsoft.com/en-us/library/6sby1byh.aspx
Is there a way in .NET to determine the amount of memory being taken up by thread-local storage?
Specifically, I'm looking to find the amount of memory used by ThreadStatic objects and by memory allocated to objects in the Thread data slots (e.g. by calling Thread.SetData).
To clarify:
Thread-local storage:
http://msdn.microsoft.com/en-us/library/6sby1byh.aspx
Thread Local Storage: Thread-Relative Static Fields and Data Slots
http://msdn.microsoft.com/en-us/library/6sby1byh.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以按如下方式获取进程的内存使用情况。您还可以在此处使用其他几种内存测量值。但是,我不太确定是否有办法通过线程获取内存使用情况。进程有 Threads 属性,它由一个集合组成ProcessThread 正是您感兴趣的,但不是获取内存使用情况的直接方法。
You can get the memory usage by process as below. There are several other memory measurements that you can use here. But, I am not quite sure whether there is a way to get the memory usage by thread. Process has Threads property which consists of a collection of ProcessThreads which is exactly what you are interested in, but not straight forward way to get the memory usage.