gpt4 book ai didi

java - 线程局部变量的存储

转载 作者:行者123 更新时间:2023-12-02 06:07:02 25 4
gpt4 key购买 nike

我有一个非常简单的问题。由于线程局部变量是用 static 修饰符声明的,因此预计它将存储在堆中。这个假设正确吗?

最佳答案

All Java objects (reference types) are stored on the heap.它与static无关。

2.5.3 Heap

The Java Virtual Machine has a heap that is shared among all Java Virtual Machine threads. The heap is the run-time data area from which memory for all class instances and arrays is allocated.

关于java - 线程局部变量的存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15302096/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com