Your SlideShare is downloading. ×
0
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Gc algorithm inside_dot_net
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Gc algorithm inside_dot_net

1,144

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,144
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
25
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. GC Algorithm inside .NET<br />Luo Bingqiao<br />5/22/2009<br />
  • 2. Agenda<br />经典基本垃圾回收算法<br />CLR中垃圾回收算法介绍<br />SSCLI中Garbage Collection源码分析<br />
  • 3. 经典基本垃圾回收算法<br />Reference Counting算法<br />Mark-Sweep与Mark-Sweep-Compact算法<br />Copying 算法<br />
  • 4. Reference Counting算法<br />Storing the Number of reference, Pointers, and resource such<br />as an Object or Memory block.<br /><ul><li>Simple reference counting
  • 5. Deferred reference counting
  • 6. One-bit reference counting
  • 7. Weighted reference counting</li></li></ul><li>Reference Counting算法<br />Advantages and Disadvantages<br /><ul><li>Reclaim objects promptly
  • 8. Difficult to resolve circular references </li></ul>Examples of Use:<br /><ul><li>COM, Cocoa, Delphi, PHP, Python</li></li></ul><li>Mark-Sweep<br /><ul><li>Initially, allocate objects on the heap sequentially
  • 9. At some stage, mark the objects that are dead and can be removed
  • 10. Free the dead object slots at some stage </li></li></ul><li>Mark-Sweep<br />Advantages and Disadvantages<br /><ul><li>Minimal house-keeping overhead (just one free list)
  • 11. Every allocation request requires a walk thru the free list, makes allocations slow
  • 12. Heap fragmentation </li></ul>Examples of Use:<br /><ul><li>C Runtime Heap, .NET Micro Framework</li></li></ul><li>Copy and Collect<br /><ul><li>Keep two heaps
  • 13. Allocate only from one heap
  • 14. When collection is triggered on the heap, copy all alive objects to the second heap
  • 15. Switch the roles of heaps </li></li></ul><li>Copy and Collect<br />Advantages and Disadvantages<br /><ul><li>Conceptual Simplicity
  • 16. Copy operation needs to be done for all objects
  • 17. Blocks a lot of memory unnecessarily </li></li></ul><li>What happens in CLR and JVM?<br />
  • 18. GC Algorithms in advanced OO language VMS<br /><ul><li>Mark Sweep Compact / Train algorithm
  • 19. Generational incremental Collector
  • 20. Large Object Heap
  • 21. Segments
  • 22. Finalization in CLR
  • 23. Weak References
  • 24. Pinning
  • 25. Object Layout </li></li></ul><li>Heap Organization<br />Heap organization for the train algorithm.<br />
  • 26. Overall of GC Algorithm<br />
  • 27. Mark Phase:<br />
  • 28. Mark Phase<br />Separate the live objects from dead objects for the<br />generation being collected. <br /><ul><li>All small dead objects have their Mark bit set, and if required Pin bit also set
  • 29. Finalizable objects are put on the FReachable queue
  • 30. Weak pointers to dead objects are nulled
  • 31. All large dead objects are put on the FreeList</li></li></ul><li>Sweep Phase:<br />Put all dead objects on a free list<br />
  • 32. Managed Heap after Compact:<br />
  • 33. Finalization Internals <br />
  • 34. More Information<br />External<br />ISMM forum<br /><<Garbage Collection>>, Algorithms for automatic Dynamic Memory managements<br />Email<br />lbq1221119@hotmail.com<br />

×