What is garbage?
In oop programming when an object is not referred in a program at present or in future that object is called garbage.
What is garbage collection?
The process of Collecting all the memories occupied by these garbage objects are called garbage collection. Generally this process happens in two steps:-
- Marking and sweeping
- Memory Compaction
How is JVM memory Structure?
[Figure 1.1: diagram for JVM memory]
Memory for objects:
In JVM objects are stored in heap data structure.
This is also called as heap memory.
Memory for non objects:
This memory is used to save information about JVM startup, methods, class.
This is also called as non-heap memory.
What is generation in JVM?
The heap memory is divided into different generation :-
1. Young generation
2. Old generation
3. Permanent generation.
What is generation collection?
Beginning with the J2SE platform, version 1.2, the virtual machine incorporated a number of different garbage collection algorithms that are combined using generational collection.JVM has different algorithms for young, old and permanent generation.
References:
1. http://java.sun.com/docs/hotspot/gc1.4.2/