Garbage collection in java
Click here to load reader
-
Upload
muthukumaran-subramanian -
Category
Technology
-
view
152 -
download
5
description
Transcript of Garbage collection in java
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