JVM Runtime Data Areas

The JVM specification describes runtime data areas such as the heap, JVM stacks, method area, program counter registers, and native method stacks.

The heap is shared among threads and stores objects and arrays. Each thread has its own JVM stack containing frames for active method invocations.

static int calculate(int x) {
    int doubled = x * 2;
    return doubled + 1;
}

Each call creates a frame on the executing thread's stack. Object values created by application code are generally managed on the heap.

Simplified JVM Runtime Areas
Key Takeaways
  • The heap is shared; each thread has its own JVM stack.
  • Stack frames represent active method invocations.
  • JVM specification concepts and HotSpot implementation details should not be conflated.