> Mostly precise scanning (stacks and registers are scanned conservatively).
Why would you code a conservative garbage collector for .NET?
> Mostly precise scanning (stacks and registers are scanned conservatively).
Why would you code a conservative garbage collector for .NET?
Edit: also you can implement conservative scan of stack and registers on Unix without writing single line of assembly code by scanning result of getcontext(), or even almost completely portably by scanning result of setjmp() + some heuristics for finding stack in memory.
And especially in case of .NET which offers pretty tight integration with unmanaged code, you can have various stack frames with layout completely out of your control on stack (I'm not sure whenever such stack frames must be scanned for pointers, but they will certainly complicate any attempts to analyze stack structure).
It has certainly been done in various Java implementations. HotSpot I'm pretty sure does precise garbage collection.
Native stacks don't need to be scanned for pointers, but the VM must of course keep track of which parts of the stack are native.
Edit: you can do stop-the-world GC at any point of program whan you scan stack conservatively, GC-safe points are only needed for precise scanning of stack and registers, so this is problem only when you want to be fully precise. Fully precise GC is certainly better when it is possible, but conservative scan works mostly well enough.
But those few objects referenced directly may keep a lot of other stuff alive. It's not that uncommon to have left-over pointers on the stack that are no longer live, but still reference a large graph of objects.