Re: Traversing the stack frame and identifying "references"
David Chase <[email protected]> Mon, 15 Jan 2007 10:23:10 -0500
| Newsgroups | gmane.comp.programming.garbage-collection.general |
|---|---|
| Message-ID | <[email protected]> |
>> But how can it be done when the garbage collector is written for >> languages like C++. Do we need to somehow ask the compiler to do >> that? Or some other techniques are used? And I realized I did not really answer your question. If you stick with the stock threading systems, you may need to reverse-engineer it. POSIX, at least at one time, had some facility to enumerate threads, but no guarantee that the threads that you got were all of them, or were still active when you received word of their existence. (It's been something like twenty years, perhaps they have fixed this.) Plan B, probably never implemented for C++, is to write your own threading system and write a compiler (or object code mutator) that enforces cooperation with threads. With your own threading system, you can pretty do what you want, and in particular, you can notice which threads have moved since the last GC -- there's room to fiddle the design. David Chase