7

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.

3
  • What data structure do you mean? It's just a bunch of contiguous memory cells. Look at the bytecode, and you'll understand. Commented Dec 7, 2013 at 12:18
  • how can I look into bytecodes, I mean binary data, is there a tool to look into it. Commented Dec 7, 2013 at 12:19
  • 1
    According to Section 2.5.2 of JVM Specification Java SE 8 Edition: The memory for a Java Virtual Machine stack does not need to be contiguous Source. Commented Jun 8, 2019 at 21:42

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.