Regarding the copy_phase of the GC; I posted the following question: >1)The first part of the "copy_phase" promotes survivors in gen 0 to > gen 1 (assuming 2 generations) by calling "copy_object_simple". This > function copies the objects to gen 1 and UPDATES (?) the references. > If so, why is it necessary the second part of "copy_phase" (calls to > "get_copied_object" and "GCHeap::Relocate" to perform the > relocation fix up.
D. Stutz kindly replied to me that: >The lines that you marked in your email are, indeed, updates. But >remember that there are many places where other refs to the same object >may be hanging out - the finalization queue, the elder generation, and >the handle table, for example. The value of these refs need also to be >updated - in the case of other calls on copy_object_simple, it is done >immediately using GetRelocated. Otherwise, take a look at >get_copied_object (and Relocate, which uses it) to see the rest of the >relocation pass in action at the end of the copy_phase. >Hope this helps! >-- David However I din't have time to analize the answer until now. Here are the lines for the first pass of gc_heap::copy_phase copy_through_cards_for_segments (copy_object_simple_const); copy_through_cards_for_large_objects (copy_object_simple_const); CNameSpace::GcScanRoots(GCHeap::Promote, ... CNameSpace::GcScanHandles(GCHeap::Promote, ... finalize_queue->GcScanRoots(GCHeap::Promote, heap_number, 0); However the first pass (code above) already goes thru these places: finalization queue, elder generation and handle table. So, I still don't see why it is necessary a second pass (calls to get_copied_object and GCHeap::Relocate) after the scavenge phase. I'm assuming that this fase doesn't move any gen0 roots (all gen0 roots were moved in the first pass) I know that I should trace the code to see why is it necessary but I'm lacking the time for it now. If some one could help, I would be very thankful. Best regards P. Felix