- Try to clarify the GC of. NET (1)
上篇文章说了一些基本概念的东西,然后还有很多东西概念没有头绪,这篇文章我试着解释
Detailed steps for GC recovery algorithm?
The article said that the. NET GC algorithm is the mark and Compact, but in the end how to do, I checked the information these days, found a blog explained that it is divided into several stages
Mark phase
This stage is not to say, is to mark the surviving object, do not consider weak Reference (weak reference) object
Plan phase
This stage is the decision to perform the compact or direct execution of Sweep (the last of the Sweep that guessed the Loh was executed is actually incorrect)
Relocate phase
This phase is when Plan phase decides the compact and begins to recalculate the address of the object that needs to be moved, noting that this time does not move, just recalculate the address
Compact phase
This phase begins moving objects.
Sweep phase
Do I need to sweep to move the finished object? Because the GC modifies all objects to be contiguous, and some of them are recycled or between surviving objects. Sweep is to use the free object to fill up the blank memory and add it to a list called free.
Why do I create a fill with a free object? It is not clear that the guess is to recycle the contiguous memory one time for the next recovery.
Why do you have a loh?
The significance of Loh's existence is for performance; Large objects are too big to move, so it takes too long to travel, so a Loh specifically stores large objects so that they are treated differently.
The previous article said that >=85000 bytes were allocated to the Loh, why is it 85000? These days to find a lot, found that because when the GC application for memory, each application to the operating system a memory block size of 8k (Allocation Quantum), reckoned with this value.
Loh Some other information
Again see a novel saying that is the Loh Gen is 3 instead of 2 to be TBD
What is the difference between Workstation,server GC mode?
- Workstation GC: So to speak, it is very conservative to carry out memory for what the management, a bit like Scrooge, a little bit of application, so the GC application memory dot.
- Server GC: That is the kind of upstart, the larger the application of memory, the more the better, so you can foresee the server GC mode, the memory cost is very alarming, when looking for data when someone running the. NET core program in Docker, the memory is too large to be restarted, After changing the workstation GC, the memory drops significantly.
Other concurrent are actually GC threads that can be executed in parallel with the user thread, improving program performance and reducing GC latency
Reference
- Https://www.cnblogs.com/HQFZ/p/4627759.html
- http://blog.csdn.net/sD7O95O/article/details/78549892
Try to clarify the GC of. NET (2)