> > > I wish to read the algorithm of gc, and I cannot. > > > > The Emacs gc is a simple mark and sweep collector. > > Right. > > Alin, you can start by reading the node "Garbage Collection" in the > ELisp manual, and then proceed reading alloc.c, where you will see > many functions named mark_SOMETHING and then gc_sweep that does the > sweep stage. If you want more background before reading the ELisp > manual, try googling "mark and sweep garbage collection". > I have read the mark-sweep algorithm; I know it. However, I do not manage making the connection with alloc.c. For example, I cannot understand what kind of objects are kept in every node of the red-black tree (in books I never saw gc implemented with red-black trees). I know that the objects are kept in obarrays. What link is there between obarrays and red-black tree of gc ? What happens to a Lisp_Object defined in C code? Is it freed if it is found by conservative stack algorithm ? What is the link between GCPRO? macros and the gc ?