java - Is frame in JVM heap allocated or stack allocated? -
The JVM specification (JSE version 8) is mentioned:
Page 12: 2.5.2 JVM pile: "Because JVM stacks do not spread directly except for push and frame, frames can be allocated piles." Page 15: 2.6: Frames: "Frames are allocated from the JMM stack to make threads." And on page 16: "Note that the frame created from the thread is local to that thread and not referred to any other thread can be done."
It seems quite confusing to me as one frame is local for thread, which creates frames, while the heap is allocated in the heap, the hep is shared between all JVM threads? It does not seem to be so far as long as something does not disappear here. The sentence on page 12 is an interesting statement.
Any hint? Thank you.
JVM Stack is an intangible one that can be assigned anywhere or anywhere. As if any method has been written by JIT, then there is no separate stock frame in it.
Hotspot JVM uses native thread stack as JMM stack. However, there are JVM implementations (eg CLDC HI) that allocate JVM stacks in the Java heap. The advantage of this approach is to have a single memory management for everyone, including Thread Stacks. On such JVM platform, standard memory managers (such as Librac) or even without OS can run.
The JVM heap is an abstract, it is not "shared" between the JVM thread than the original thread stacks. In the heap, threads can be made along with local areas as well, at the same time, the piles of the original thread live in virtual memory, which are also shared between all the threads of the process.
Comments
Post a Comment