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