Componentizing D's garbage collector

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Jan 14 09:38:39 PST 2014


14-Jan-2014 01:24, "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>" пишет:
> On Monday, 13 January 2014 at 21:08:50 UTC, Dmitry Olshansky wrote:
>> So what? It can't move it and as such there is nothing special about
>> it, it doesn't _cost_ anything to pin object.
>
> Well, the advantage of compaction is that you (in theory) can relocate
> objects so that you:
>
> 1. get temporal and spatial coherency (sitting on the same page, to
> avoid paging)

Bleh. If anything you may as well lose it - manual memory management is 
the only option to guarantee you something to the extent of having 
related object together in the same page. That is if you can make it so 
by hand.

Segregated heaps also get fine locality for similarly-sized objects.

> 2. get rid of fragmentation (less paging, requires smaller address space)
> 3. can have a faster and simpler allocator
>
> If you start using the GC heap for "malloc" with pinning, you loose a
> lot of that? That's the cost.
>

This is a missed potential not an extra cost.
On the contrary write barriers to track precisely every pointer write do 
*cost* something. This cost is then regained (with interest) by applying 
simpler and efficient algorithms such as semi-space compaction.


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list