garbage collection in java
Post on 26-May-2015
152 Views
Preview:
DESCRIPTION
TRANSCRIPT
Garbage collection
● Garbage collection is the process of looking at heap memory, identifying which objects are in use and which are not, and deleting the unused objects.
● An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object.
● An unused object, or unreferenced object, is no longer referenced by any part of your program.
Steps involved in garbage collection
● Marking● Normal deletion● Deletion with compaction
Generational garbage collection
Types of generational garbage collection● young generation objects● Old generation objects● Permanent generation objects
Steps involved in Generational garbage collection
● Object allocation● Filling the Eden space● Copying reference object● Object aging● Additional aging● promotion
Object allocation
Filling eden space
Copying reference objects
aging
Additional aging
Promotion
Sample code
Garbage collection output
Any queries?
Thank you
top related