GC Destruction Order

bitwise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 20 06:54:28 PDT 2015


On Wednesday, 20 May 2015 at 08:01:46 UTC, Kagamin wrote:
> On Tuesday, 19 May 2015 at 22:15:18 UTC, bitwise wrote:
>> Thanks for confirming, but given your apparent tendency toward 
>> pinhole view points, it's unsurprising that you don't 
>> understand what I'm asking.
>
> And what you're asking. Just for the record: C++ memory 
> management techniques are not designed to work in GC 
> environment.

Yes, but D claims to support manual memory management. It seems 
to get second class treatment though. I'm pretty sure I can 
PInvoke malloc in C# too ;)

> On Wednesday, 20 May 2015 at 03:44:58 UTC, bitwise wrote:
>> Basically, I can't design a struct and be sure the destructor 
>> will be called on the same thread as where it went out of 
>> scope.
>
> If your resource finalization code has some specific threading 
> requirements, you implement those yourself in a way your code 
> requires it. Or instead freeing resources normally in due time.

  AFAIK D does not provide any built in functionality like 
Objective-C's 'runOnMainThread', which makes this a painful 
option.


More information about the Digitalmars-d-learn mailing list