Is the frame dedicated or dedicated JVM heap?

The JVM Specification (JSE 8 Edition) mentioned:

Page 12: 2.5.2. JVM drives: "Because the JVM stack is never controlled directly, except for push and pop frames, frames can be heaped."

Page 15: 2.6: Frames: "Frames are allocated from the JVM stack of the thread creating the frame." And on page 16: "Note that the frame created by the stream is local to this stream and it cannot be referenced by any other stream."

That sounds pretty confusing to me. Since the frame is local to the thread that creates the frame, why allocate the frame to the heap, since the heap is distributed among all JVM threads? It does not make sense if something is not missing here. The sentence on page 12 is an interesting expression.

Any clues? Thanks.

+6
source share
1 answer

The JVM stack is an abstraction. It can be placed anywhere or anywhere else. For instance. if the method is inline with JIT, it does not have a separate stack frame.

HotSpot JVM uses its own thread stack as a JVM stack. However, there are JVM implementations (such as CLDC HI) that allocate JVM stacks in the Java heap. The advantage of this approach is to have a single memory management for everything, including thread stacks. Such a JVM can run on a platform without a standard memory manager (for example, libc) or even without an OS.

JVM Heap is also an abstraction. This is no more "shared" between JVM threads than native thread threads. There may also be threaded areas in the heap. At the same time, sets of native threads are stored in virtual memory, which is also shared between all threads of the process.

+3
source

Source: https://habr.com/ru/post/977722/


All Articles