The Book of the Runtime is a great resource on the GC, but it glosses over the details of many aspects of the GC that are important to understanding how the system works on a deep level. Today, it's very difficult to understand the GC just by looking at the Book of the Runtime alone - it takes a lot of time, reading gc.cpp, and debugging to get a feel for the different aspects of the GC and how they interact.
It would be great if we had centralized, detailed documentation for GC internals in addition to the Book of the Runtime in the hopes of lowering the barrier of entry into the GC.
Some issues where GC internals have been discussed (would be great candidates for documentation!)
Some topics that aren't covered by the BOTR, off the top of my head (would also be great candidates for documentation):
cc @karelz @Maoni0 @adityamandaleeka @sergiy-k
also cc @303248153 who asked many of the questions linked in this issue
I'm also interested in the conditions that trigger garbage collections. Obviously free space will, but I see a lot triggered by fragmentation, and the collection is unsuccessful in reducing the fragmentation, but keeps trying to.
@krs43 Do you have pinned objects in your scenario? What is your memory load like?
Pinned objects can cause fragmentation (since, obviously, they cannot be moved). Under certain circumstances, the GC might notice that fragmentation and think it can shrink the heap if it does a collection, but of course it will be unsuccessful at this because it can't do anything about the pinned objects.
If you have other questions or would like to discuss this further, I recommend opening a separate issue.
I would suggest to split off specific questions into separate issues, so this one doesn't become a one giant one. We should track only actionable docs update here ... (speaking from experience with large muddied discussions on CoreFX ;-))
A few days ago I wrote an article about GC internals in chinese, and I'm agree with swgillespie, BOTR is great but far from enough.
I hope the new document would include these topics:
In addition to improving the document I also want more comments around gc codes, like explain the hundreds members in gc_heap and members in dynamic_data.
Here's translation of the article.
@303248153 are you interested in contributing some of these docs to the repo?
Or do you have suggestions / contributions to the comments? (not sure how practical it is to comment on fields without pointing to the big picture)
@karelz
Although I am willing to contributing some documents about these topics, it's better to let @swgillespie and @Maoni0 do it because they are more familiar with these code and they can provide more accurate information.
Also adding comment to members of gc_heap and dynamic_data is necessary with or without a big picture IMO, when I'm reading these code I feel so painful to guess the role of a field, I had to read thousands of lines to figure out, sometimes I just need a very little help, that's the comment.
I know that everyone it pretty busy with real (dev) work, but are there still plans to do this?
@mattwarren It's something I'd like to do, but unfortunately I just haven't found the time. 馃槥
:mips-interest
this should be closed. in the BotR GC chapter I've recommended to read @kkokosa's Pro .NET Memory book which talks about a lot of details of the GC code.
Most helpful comment
this should be closed. in the BotR GC chapter I've recommended to read @kkokosa's Pro .NET Memory book which talks about a lot of details of the GC code.