[英]Get memory usage of a thread
A Thread shares everything except its stack and the CPU cycles with all other threads in the VM. 线程与VM中的所有其他线程共享除堆栈和CPU周期以外的所有内容。 All objects created by the Thread are pooled with all the other objects. 线程创建的所有对象都与所有其他对象合并在一起。
The problem is to define what the memory usage of a Thread is. 问题是要定义线程的内存使用量。 Is it only those objects it created? 仅仅是它创建的那些对象吗? What if these objects subsequently are referenced by other threads? 如果这些对象随后被其他线程引用怎么办? Do they only count half, then? 那他们只算一半吗? What about objects created somewhere else, but are now referenced by this Thread? 那么在其他地方创建但现在被该线程引用的对象呢?
I know of no tool trying to measure the memory consumption of separate Threads. 我知道没有工具尝试测量单独线程的内存消耗。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.