GC Blacklisting
dsimcha
dsimcha at yahoo.com
Thu Feb 24 20:38:52 PST 2011
I've been optimizing the druntime garbage collector lately, and as I've
found several smaller optimizations since I submitted my patch last
week, I've temporarily forked the druntime Git repository to store those
optimizations. The results are here:
https://github.com/dsimcha/druntime/wiki/Druntime-GC-Optimization-Fork
In the process, I've built up such a good mental model of the GC
codebase that I'd hate to see it go to waste.
On 32-bit systems, false pointers are a big problem with conservative
garbage collection. Apparently this problem can be drastically
mitigated by blacklisting memory addresses that have false pointers
pointing at them. (See
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.92.961&rep=rep1&type=pdf)
I'm wondering if such a technique is worth implementing in the D
garbage collector.
Reasons why it may be worth doing:
1. It would drastically mitigate false pointers.
2. For the most part, it wouldn't be too hard to implement, now that I
have a good mental model of the GC.
Reasons why it may not be worth doing:
1. It would create some (probably small) additional overhead in the GC.
2. IIUC false pointers are, for all practical purposes, not an issue on
64 bit because the address space is so sparse. Even on a 16 gigabyte
heap, a random 64-bit pattern only has about a 1 in a billion
probability of pointing to a valid heap address. 32 bit is a crufty
legacy technology that's on its way out (rapidly now that DMD's 64-bit
codegen works). 64-bit is the future.
3. If the precise heap scanning patch that's been in Bugzilla for a
while ever gets in, the false pointer issue might become mostly moot.
4. Long-term, when/if D becomes a language successful enough to have
serious resources thrown at it, the GC will probably be rewritten by GC
experts working full time on it, rather than a few jack-of-all-trades
programmers who don't specialize in GC.
5. Figuring out a good heuristic for performing very large allocations
in the presence of blacklisting would be rather difficult. Do you keep
asking the OS for more memory to avoid allocating a blacklisted page no
matter what? If not, where/how do you draw the line?
Please comment on whether you think this is worth doing.
More information about the Digitalmars-d
mailing list