Sending an immutable object to a thread

rsw0x via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 21 14:44:06 PDT 2015


On Sunday, 19 July 2015 at 17:12:07 UTC, rsw0x wrote:
> On Sunday, 19 July 2015 at 17:04:07 UTC, Frank Pagliughi wrote:
>>> [...]
>>
>> Oh, yes, pointer. Ha! I didn't even think of that. Thanks.
>>
>> I'm not familiar with how garbage collection works in D. If 
>> the initial reference goes out of scope, and you just have a 
>> pointer - in another thread, no less - then are you still 
>> guaranteed that the object will not disappear while the 
>> pointer exists?
>>
>> [...]
>
> a pointer to a pointer(or in this case, a reference) does not 
> keep it alive.

wow, I don't even remember posting this.

This is (mostly) wrong, but I'm unsure if a pointer to another 
pointer on the stack would correctly keep its object alive(but, I 
believe this would just be a bug I think,) If the pointer was 
pointing to a pointer on the heap, then AFAICT it would keep it 
alive.


More information about the Digitalmars-d-learn mailing list