3 ms·
> Why don't they just use the Deutsch-Schorr-Waite algorithm Here is a good reason: you're debugging some problem that occurs in the middle of garbage collecti
by kazinator 9y ago
> Why don't they just use the Deutsch-Schorr-Waite algorithm
Here is a good reason: you're debugging some problem that occurs in the middle of garbage collection. You have the world stopped and would like to look at some objects. Oops, pointers are scrambled by this algorithm and won't be put back in place until it runs to completion. (Which it might not even be able to do due to whatever bug you're trying to investigate, even if you have a way to initiate that.)
With regular recursive traversal, you can just bail garbage collection at any time: loop through all the heaps, and reset the gc bits of all objects to the "unmarked" state. Then examine whatever you want.
(If the bits aren't in the type tag, you don't even have to do that; though it's a good idea for them to be in a type tag because then an object which has been mis-handled by memory management (e.g. marked object remains in the live object graph after gc) then it has the wrong type and blows up when used.)
- cwzwarich 9y agoIn practice, if you get something like this wrong and are forced to debug it, you will probably have to do some code inspection or printf debugging to find the cause. But it's still better than most concurrent GC algorithms in that regard.
- kazinator 9y agoWhat can't you debug with code inspection and printf? Some black box with that has no printf (or not that you can insert into a custom build), and for which code isn't available.