We have two places where we have garbage collector algorithms. One uses a general generation framework and starts in src/share/vm/memory/genCollectedHeap.[hc]pp and continues in the files named gen*, *Generation, *Space, etc. The second uses a less flexible (but more efficient?) class hierarchy and is in src/share/vm/gc_interface/ and src/share/vm/gc_implementation/.
The whole thing hangs together because of the meta-circular class hierarchy for references garbage-collectably objects defined in src/share/vm/oops/oopsHierarchy.hpp and implemented by the other files in that directory.
All the GC code depends on inline code for allocation and for remembered set maintenance that is mostly implemented in the runtime compilers. You'll see what we call "slow-path" implementations of those operations (e.g., for use by the interpreter), but mostly we try to avoid using those methods for performance reasons. (There's a fair amount of complexity to achieve performance.)
The algorithms themselves have been described in various talks and papers, but not with all the complexities you'll see in the code. Can we (the Sun GC team) help you in your analysis? We are always interested in what people find in our code.
Sir,
We are really thankful to you for your readiness to help us.
The GC code is written in C++.Though we have basic knowledge of C++,is we require particular topic in C++ to study that code?
We are somewhat confused about where to start?
Please,give us some insight in that case.
You may find the following white paper useful as a
starting point:
http://java.sun.com/j2se/reference/whitepapers/memorymanagement_whitepaper.pdf
Look for JavaOne talks (presentations) on "HotSpot Garbage Collection",
which can be found rooted off of, for example:
http://developers.sun.com/learning/javaoneonline/
Other than that, much of the documentation of the algorithms
and supporting data structures is in the C++-code comments.
If you have specific questions, let us know and we can see how we can
help you most efficiently.