Sending an immutable object to a thread

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


On Tuesday, 21 July 2015 at 21:44:07 UTC, rsw0x wrote:
> On Sunday, 19 July 2015 at 17:12:07 UTC, rsw0x wrote:
>> [...]
>
> 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.

addendum:
http://dlang.org/garbage.html

>Pointers in D can be broadly divided into two categories: Those 
>that point to garbage collected memory, and those that do not. 
>Examples of the latter are pointers created by calls to C's 
>malloc(), pointers received from C library routines, pointers to 
>static data, pointers to objects on the stack, etc.

>and those that do not ... pointers to objects on the stack, etc.

I believe this implies that it would *not* keep the object alive.

Sorry for the confusion/noise.


More information about the Digitalmars-d-learn mailing list