Where is the instance of the [Java] object stored in the Java virtual machine stack (VM Stack)?

for example, the member variable of a class:

Object obj = new Object();

obj is an instance of an object. In a broad sense, it is stored on the "stack" and points to the memory address on the "heap". Specifically, I have the impression that obj should be stored on the virtual machine stack (VM Stack) in the runtime data area.
I know that the virtual machine stack stores stack frames:

A complete stack frame contains: local variable table, Operand stack, dynamic connection information, method normal completion information and method exception completion information.

in which the local variable table is stored again:

The
local variable table stores various basic data types known at compile time, object reference type , and returnAddress type (address pointing to a bytecode instruction: function return address).

the question is that the life cycle of stack frames that go on and off the stack with the execution of the method should be very short, so is the obj mentioned above stored in the local variable table in the stack frame as a reference to the object and a member variable of the class? In addition, where are the parameters of a function stored? is it also a local variable table?

Mar.20,2021

Object obj = new Object (); creates two addresses in memory, one is new Object () on the heap, and the other is obj, which is the object reference, created on the stack and points to the new Object () heap address. If Object obj = new Object () is executed in the method, the obj stack is destroyed after the method ends, but the one on the new Object () heap is not destroyed and has to be reclaimed by gc. All object references and basic type data (such as int,byte,long,float,char, etc.) are created on the stack. The function parameters are the same as the parameters in the function, the object reference is copied and passed to the target function, and the target function is destroyed after execution.

Menu