shared by all threads: method area, heap memory, native method call

owned by one thread: stack memory, PC register

Method area

This area is shared across multiple threads and the method area is created right

when the JVM starts up.

Stack Memory

store method calls and local variable

one for each thread

each method has a stack frame.

stack frame has three parts:

Local Variable Array

The Local variable array contains all the parameters and local variables of a method. Each block in this array

is of 4 bytes. To store integers and floating point numbers,

one block is enough because they take 4 bytes. To store double and long.

we need 2 blocks because we need 8 bytes to store them. Byte, short and char are converted into

integer and they are stored using 1 block.

Operand Stack

So it pushes and pops, pops and pushes operands while

performing various operations based on the statements we put in the code.

Frame Data

It contains a Constant Pool information of a particular method.

It also contains the reference to Exception table.

That is, it provides the corresponding catch block information in case of exceptions at runtime.

Heap Memory

All the objects that are created in our application are stored in the heap area.

If we as developers can do any damage, that is to the heap area as well as the stack area. All the threads can access

this area and they share it.

And this area is also created during JVM startup.

PC Register Area

PC Registers stand for Program Counter Registers and they store the address of the current executing

instruction. Every thread will have its own PC Register.

And once the instruction execution is completed, the PC register will be incremented to the address of

the next instruction that should be executed.

Native Method Stack

store any native method call information. That is, calls

into other language methods such as C and C++ which we use doing Java native interface.

One per thread

results matching ""

    No results matching ""