Java Core Flashcards

1
Q

Types of Memory in Java

A
5 Types:
Class(Method) Area
Heap
Stack
Program Counter Register
Native Method Stack
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Class Method Area

A

This part of the JVM memory area is shared by all executing threads.

Class elements like constant pool, class fields, constructor codes, method codes, etc.

Method area can be considered as a part of the heap area but stores per-class data only.

We can say that the method area is responsible for holding class level information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Heap Memory

A

Heap Memory in java is used by java runtime to allocate memory to objects and class during the execution of a java program.

Whenever an object is created in java, it gets stored into heap memory.

A Process called garbage collection runs on heap memory to free up unnecessary space that is garbage collection removes those objects from the heap area which does not have any references

How well did you know this?
1
Not at all
2
3
4
5
Perfectly