[D-runtime] GC expectations from TLS?

Fawzi Mohamed fawzi at gmx.ch
Sat Nov 13 01:37:31 PST 2010


having a real weak pointer is not easy and has a cost because there is  
a hole between marking an object as collected and calling its dtor  
(that array don't even have by default).

But in your case you will never dereference an object that might have  
been collected, so it is easier.

Probably the easiest way to have what you want is to use a struct that  
keeps the prt as non aligned size_t value (just (arr.ptr | 1) and  
remove that bit when needed, the scanning should ignore the non  
aligned value, and you are ok...

On 13-nov-10, at 00:26, Steven Schveighoffer wrote:

> Static ctor/dtor?
>
> Sent from my iPhone
>
> On Nov 12, 2010, at 5:56 PM, Sean Kelly <sean at invisibleduck.org>  
> wrote:
>
>> On Nov 12, 2010, at 12:25 PM, Steve Schveighoffer wrote:
>>>
>>> I would like to avoid a heap allocation (which I know will work)  
>>> on every thread
>>> creation, but it's looking to me like this is what's going to have  
>>> to happen.  I
>>> probably can use malloc to avoid it being scanned.  Is there  
>>> another way?
>>
>> I don't think there is.  The TLS block is static memory, so there's  
>> no way to flag it as not containing pointers.  You'll need some way  
>> of being notified when the block is collected too.
>> _______________________________________________
>> D-runtime mailing list
>> D-runtime at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/d-runtime
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime



More information about the D-runtime mailing list