garbage collection in java

14

Click here to load reader

Upload: muthukumaran-subramanian

Post on 26-May-2015

151 views

Category:

Technology


5 download

DESCRIPTION

working of garbage collection in java

TRANSCRIPT

Page 1: 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.

Page 2: Garbage collection in java

Steps involved in garbage collection

● Marking● Normal deletion● Deletion with compaction

Page 3: Garbage collection in java

Generational garbage collection

Types of generational garbage collection● young generation objects● Old generation objects● Permanent generation objects

Page 4: Garbage collection in java

Steps involved in Generational garbage collection

● Object allocation● Filling the Eden space● Copying reference object● Object aging● Additional aging● promotion

Page 5: Garbage collection in java

Object allocation

Page 6: Garbage collection in java

Filling eden space

Page 7: Garbage collection in java

Copying reference objects

Page 8: Garbage collection in java

aging

Page 9: Garbage collection in java

Additional aging

Page 10: Garbage collection in java

Promotion

Page 11: Garbage collection in java

Sample code

Page 12: Garbage collection in java

Garbage collection output

Page 13: Garbage collection in java

Any queries?

Page 14: Garbage collection in java

Thank you