The way go_through_object works is that is depends on the "exp" you pass in. I'll assume that you simply want to collect all objects starting at the root. I think your termination condition fails for cycles of objects. Consider A -> B -> A reference chain - A will consider B, which will consider A, which will consider B. The work around could be to ignore objects that are already marked.
Vladimir 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 Archana Sent: Wednesday, July 23, 2003 10:44 PM To: [EMAIL PROTECTED] Subject: [DOTNET-ROTOR] the right way of using go_through_object Hi, When i tried to insert code to do scavenging using the go_through_object macro, i am running into an infinite loop, can you please point out where i am going wrong, [ for the time being i am looking at only the minor collection] To avoid looping endlessly when i removed the lines 17-23 i get a corrupted object ref which i presume is due to some object not being copied. 1.for each root { 2. if(root!=NULL and root contains pointers) { 3. go_through_object (method_table (root), root, size(root), xx, 4. { 5. relocateChild(xx); 6. } 7. ); 8. } 9.} 10.relocateChild(obj) { 11. if(generation(*obj)==0) {//consider only young objects 12. if(*obj is valid) { 13. if(*obj.relocated address == NULL) { 14. copy_object_simple(obj) 15. } 17. if(*obj && contain_pointers(*obj)) { 18. go_through_object(method_table(*obj),*obj,size(*obj),xx, 19. { 20. relocateChild(xx); 21. } 22. ); 23. } 24. } 25. } 26.} //end relocateChild Thanks and Regards archana