New pointer type for GC

Etienne via Digitalmars-d digitalmars-d at puremagic.com
Tue May 27 07:42:32 PDT 2014


On 2014-05-27 10:18 AM, "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Tuesday, 27 May 2014 at 13:58:26 UTC, Etienne wrote:
>> That's true, though you still need the thread ID for references to
>> pointers and you need to be able to pass those pointers to C.
>
> I am not really sure how useful references to gc-pointers is. I
> certainly would trade them in for multiple return values. I also think
> it is reasonable to ban transfer of GC mem to C code if all GC mem is
> accounted for with gc-typed pointers...

I think the GC is the future of D considering it's embedded to the very 
core of the language, and compatibility with C code is ... elementary.

Also, thread IDs in ptr references are to the GC as ref counts are to 
the smart pointers. If you remove the refCount from smart pointers, you 
end up scanning the whole memory to count them don't you? So then, why 
remove the thread ID from GC references, if only to look for them in 
each thread? You slow the GC down by as much total memory there is in 
all threads vs the avg in a thread, AND you remove parallel collection - 
by not having the Thread ID in gc ptr references

So you understand that's exactly why the GC has to stop the world, and 
no gaming platform will ever turn to the default behavior of a language 
if it stops its world. As a matter of fact, I can't see any other way of 
fixing the GC than adding the Thread ID in there :/


More information about the Digitalmars-d mailing list