Mac Apps That Use Garbage Collection Must Move to ARC

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 15:05:21 PST 2015


On Thursday, 26 February 2015 at 21:17:57 UTC, Benjamin Thaut 
wrote:
> Am 26.02.2015 um 20:58 schrieb Walter Bright:
>>
>> It was a generational gc, I described earlier how it used page 
>> faults
>> instead of write barriers. I eventually removed the page fault 
>> system
>> because it was faster without it.
>
> Page faults are inferrior to compiler generated write barriers. 
> Because with a page fault startegy you pay for every write. 
> Even if the write does not write a pointer. Compiler generated 
> write barriers only apply to pointers written through another 
> pointer.

It is a tradeof.

You can implement write barrier in the codegen. In which case you 
check them every time, but only for pointers. The check is cheap 
but creeping.

You can implemented them using memory protection. In which case 
it is WAY more expensive and will trap all the write, but ONLY 
when needed (it can be turned on and off) and usually you trap 
once per page.

Note that in D, you have union and all kind of crap like that, so 
what is writing a pointer is non obvious and so the tradeof is 
very different than it is in other languages.


More information about the Digitalmars-d mailing list