©  Konrad Kokosa 2018
Konrad KokosaPro .NET Memory Managementhttps://doi.org/10.1007/978-1-4842-4027-4_9

9. Garbage Collection - Plan Phase

Konrad Kokosa1 
Warsaw, Poland

After the mark phase, all objects have been identified as reachable or not. Those reachable are being marked by a dedicated bit. Some of the marked objects may be additionally marked as pinned by another bit. At this moment Garbage Collector has all necessary information to start its job. But the question arises - should it proceed with Sweep or Compact collection?

To answer this question, we can do one of two things. We can make an educated guess, for example - based on the previous memory usage patterns or the previous effects of sweeping and compacting collections. However, ...

Get Pro .NET Memory Management: For Better Code, Performance, and Scalability now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.