GcScanRoots and GcScanHandles don't push object pointers onto the mark stack: they directly mark the objects as live, and for each live object, push pointers to objects referenced from that first level onto the mark stack. See GCHeap::Promote() for details: it is called from GcScanRoots/GcScanHandles for each object enumerated.
Objects are pushed on the mark stack in gc_heap::mark_object_internal(), with this line: "*(mark_stack_tos++) = o;", and popped within the same function, by "oo = *(--mark_stack_tos)". Barry This posting is provided "AS IS" with no warranties, and confers no rights. -----Original Message----- From: Discussion of the Rotor Shared Source CLI implementation [mailto:[EMAIL PROTECTED] On Behalf Of Albert Miranda Sent: Friday, December 12, 2003 1:17 AM To: [EMAIL PROTECTED] Subject: [DOTNET-ROTOR] About GcScanRoots Hello, I think the GC thread uses CNameSpace::/CFinalize::GcScanRoots & GcScanHandles to find all the references in the stacks, handles and finalize queue that 'point' to objects in the GCHeap. Thus it is able to find which objects are alive in the GCHeap. If one of such objects contains pointers to other objects, these ones will be marked alive as well, won't they? I believe that ONLY the roots are located with these functions, and they're stored in a mark stack. Later this stack is traversed, and if an object pointed to by one of these roots contains more pointers to objects, these pointers are added to this stack. This way, eventually the stack will contain all the possible references that make objects in the heap alive, and then it'll be just a matter of following these references and marking them. My question is, am I right? And if so, where in the code is this mark stack populated. (I suppose that GcScanRoots and the like only traverse the stack (or other structures associated to them) but they don't locate the objects "pointed to by objects referenced from the stack", but only the roots) Thank you very much for your patience, and thank you in advance. Answer please, because this is an important matter for my project. =================================== This list is hosted by DevelopMentor(r) http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com