Componentizing D's garbage collector

Jacob Carlborg doob at me.com
Mon Jan 13 02:59:44 PST 2014


On 2014-01-13 10:20, Rainer Schuetze wrote:

> Maybe I'm too pessimistic ;-) I guess moving in general could be ok, I
> was thinking about segregating heaps by type (shared/immutable/mutable)
> and moving data between them adds restrictions. I'd like to be proven
> wrong.
>
> Some thoughts regarding a moving collector:
>
> - interfacing with C/C++ is problematic: even if a pointer is passed on
> the stack, it is not guaranteed that this stack entry is not modified by
> the called function. While this might cause problems when collecting
> memory due to this being the last reference to the data, it is much more
> likely that there are still references, but moving pointers will
> definitely fail.
> Having to explicitely pin every pointer passed to C functions would be
> very expensive.

Could we have a segregated heap for C pointers? Would that help? 
Basically having a special function allocating everything that should 
interface with C.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list