Am 12.01.2014 12:03, schrieb Dmitry Olshansky:
12-Jan-2014 14:27, Rainer Schuetze пишет:
On 11.01.2014 22:20, Benjamin Thaut wrote:
Am 11.01.2014 21:44, schrieb Andrei Alexandrescu:

Well as far as my understanding of GCs goes, you have two options:

1) Impercise pointer discovery => limiting yourself to a mark & sweep
2) Percise pointer disccovery => option to use a semi space GC in
combination with a mark & sweep and generations, which allows for
superior handling of short lived allocations (which is the biggest
problem of D's current GC).

Also without percise pointer discovery you will never be able to move
objects from one heap into another. This would be especially a problem
for the immutable heap, because you might want to allocate all strings
on the thread local heap until you discover that you actually need them
to be shared between threads. You might also need to move objects into
antoher heap whenever a casts happens or global variable is assigned.

Kind Regards
Benjamin Thaut

I think a moving collector is currently not feasible without restricting
the language a lot, probably similar to safe D and more. I'm not sure we
want that in general.

I might be ignorant but why can't we make "mostly-moving" collector?

For that we discern precise pointers (with typeinfo) and conservative
(such as potential pointers in registers/stack). Then any block pointed
to by a least one conservative pointer is pinned, others though can be
moved freely since all of the pointers are known.



A semi-space garbage collector is best fitted for small short lived allocations. Which are mostly those that are referenced by the stack because they happend as functions are called. And for a semi-space garbage collector there is not mostly moving, it has to copy _all_ objects from one heap onto another so that those left on the original heap are known to be all garbage, can be destroyed and then the heap can be reused for the next collection. Mostly-moving doens't work here. Either you know all pointers percisely, or you don't do it. What you mean is pinning, you can pin objects for which you know they might be referenced by a impercise pointer and thus prevent them from beeing moved around. But this type of moving only works with mark & sweep compacting collectors and thats not really better than what we already have.

If you are really interrested in the topic I higly recommend reading "The garbage collector handbook".

Kind Regards
Benjamin Thaut

Reply via email to