JVM - Heap and Stack

java, jvm, memory, multithreading

Solution

Reference types are in heap.

Any primitive type data and references to values on heap (parameters / local variables of method) are on the stack.

Each thread has its own stack.

All threads in the application share same heap.

Problem

Whenever a class is loaded, what are stored in the heap and what are stored in the stack ? Also where does the threads reside ?

Original source