Java线程实例化并启动时分配了多少内存(粗略)?创建Java线程时的内存使用量
下面是一个代码示例:
// Definition of the thread class
class BasicThread extends Thread {
// This method is called when the thread runs
public void run() {
}
}
.
.
.
// Create and start the thread
Thread thread = new BasicThread();
thread.start();
取决于32位或64位的VM。阅读这篇文章:http://www.javaspecialists.eu/archive/Issue029.html但你为什么问?你想开始数千个线程吗? – 2011-06-14 17:31:08
42个字节(正好)。 – 2011-06-14 17:34:51