garbage collection in d

Robert Jacques sandford at jhu.edu
Wed Apr 7 13:48:47 PDT 2010


On Wed, 07 Apr 2010 18:01:47 -0300, Daniel Oberhoff  
<daniel at danieloberhoff.de> wrote:
> On 2010-04-07 20:40:27 +0200, Sean Kelly <sean at invisibleduck.org> said:
>>  It's still possible to build druntime with a custom GC.  You can even  
>> have a "GC" that simply calls malloc/free if you avoid coding that  
>> relies on implicit collection of discarded memory.  See gc_stub for an  
>> example.  As for better GC implementations, there are a bunch of  
>> options, but I don't know that we can go so far as an incremental  
>> collector ala Java.  That D can call C code causes problems there.
>
> ah, I had been thinking about that. actually, you can call c code from  
> java and .net. The point is that you have to take care about the memory  
> you pass into the c function, and that which you get out. so there must  
> be a sane way, right?
>
> Best
>
> Daniel
>

Nope, not really. .NET C integration is done via message passing (aka  
marshaling) or via COM objects. I would hazard Java does it similarly.  
This is both slow, inefficient and somewhat limiting. Furthermore, given  
that all too often you have to manually write custom marshallers, its also  
a big pain in the butt. Beyond C, D also supports assembler as a core  
language feature.



More information about the Digitalmars-d mailing list