
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Types of Memory Areas Allocated by JVM in Java
Java Virtual Machine is a program/software that runs Java applications. It takes Java bytecode (.class files) and converts the bytecode (line by line) into machine-understandable code, line by line so the processor can understand and execute it.
JVM contains a module(components) known as a class loader. It is responsible for loading the program into memory and preparing it to run. Class Loader performs three main tasks -
-
It Loads the class into the memory.
-
It Verifies the byte code instructions.
-
It Allocates memory for the program to run.
Types of Memory Areas in JVM
The JVM divides memory into several areas, and they are -
-
Heap: Runtime storage allocation for objects (reference types). It is shared across all threads.
-
Stack: Storage for local variables and partial results. A stack contains frames and allocates one for each thread. Once a thread gets completed, this frame also gets destroyed. It also plays a role in method invocation and returns.
-
PC Registers: Program Counter Registers contain the address of an instruction that JVM is currently executing. Every thread has its own PC register.
-
Execution Engine: It converts bytecode into machine code. It has a virtual processor, interpreter to interpret bytecode instructions one by one and a JIT, just in time compiler.
-
Native method stacks? It contains all the native(that is not Java) methods used by the application. These are used when Java communicates or invoke native system-level resources through native method calls.