Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Garbage collection in java


Published on

working of garbage collection in java

Published in: Technology, News & Politics
  • Be the first to comment

  • Be the first to like this

Garbage collection in java

  1. 1. 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.
  2. 2. Steps involved in garbage collection ● Marking ● Normal deletion ● Deletion with compaction
  3. 3. Generational garbage collection Types of generational garbage collection ● young generation objects ● Old generation objects ● Permanent generation objects
  4. 4. Steps involved in Generational garbage collection ● Object allocation ● Filling the Eden space ● Copying reference object ● Object aging ● Additional aging ● promotion
  5. 5. Object allocation
  6. 6. Filling eden space
  7. 7. Copying reference objects
  8. 8. aging
  9. 9. Additional aging
  10. 10. Promotion
  11. 11. Sample code
  12. 12. Garbage collection output
  13. 13. Any queries?
  14. 14. Thank you