How many types of memory areas are allocated by JVM?
There are six main types of memory areas that are allocated by JVM. These include:
1. Class loader – a subsystem of JVM that is used to load class files.
2. Class (Method) Area – stores per-class structures such as the runtime constant pool, field and method data, the code for methods.
3. Heap - is the runtime data area in which objects are allocated.
4. Stack - stores frames and holds local variables and partial results. Participates in method invocation and return.
5. Program Counter (PC) Register - contains the address of the JVM instruction that is currently being executed.
6. Native Method Stack - contains all native methods used in the application.