I have a very simple question. Given that Threadlocal variables are declared with static modifier, it is expected that it will be stored in heap. Is this assumption correct?
All Java objects (reference types) are stored on the heap. It has nothing to do with 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With