It is evident from Java Virtual Machine Implementation (http://docs.oracle.com/javase/specs/jvms/se7/html/index.html) that stack frame present on heap which stores the method's runtime data. But what are the contents of stack frame in java and how the stack frame is organized to store values of local variables and intermediate results. How is the data structure organized.
1 Answer
First of all, stack frame is part of JVM stack, not Heap [JVM memory is divided in 5 parts: Method Area, Heap, Stack, PC Register and Native Memory.]
To answer your question, stack frame is divided into three parts: local variable array, frame data and operand stack. Refer to the following link for detailed info: http://www.artima.com/insidejvm/ed2/jvm8.html
1 Comment
Carlos Raffellini
According to Section
2.5.2 of JVM Specification Java SE 8 Edition: Because the Java Virtual Machine stack is never manipulated directly except to push and pop frames, frames may be heap allocated Source.
2.5.2of JVM Specification Java SE 8 Edition: The memory for a Java Virtual Machine stack does not need to be contiguous Source.