How Many Types of Memory Areas Are Allocated by JVM?

Java Virtual Machine is one of the most important components which does particular types of work.

  1. Loading of code
  2. Verification of code
  3. Executing the code
  4. Providing a run-time environment for the users

All these functions take different forms of the memory structure. These data structures are:

  • Heap
  • Stack
  • Program Counter Register
  • Native Method Stack

Let us discuss each of the above memory structures' characteristics:

Heap memory structure is usually implemented for allocating memory dynamically. Variables assigned with this type of memory structure can be allocated at runtime, but they have slow accessing of memory.

Stack memory structure is mostly implemented for providing static memory allocation. Programmers could make use of stack if they knew in advance how much memory needs to be allocated for the storage of data.

Program Counter Register: Programs are a set of instructions or orders feed to a computer for performing. These instructions are delivered to the processor by the program written by a human. Program counter register holds the address of the upcoming instructions to be executed.

Native methods form a stack that is primarily implemented to line up with your system calls as well as libraries scripted in different computer language.


Here are few other related articles for you to read:

Courses
Subscribe Updates via Email

Join 49,000+ W3schools lovers and get all the latest tutorials, programs, algorithms in your inbox.