Can't I allocate at descontructor?

Max Haughton maxhaton at gmail.com
Fri Mar 5 20:18:44 UTC 2021


On Friday, 5 March 2021 at 20:13:54 UTC, Jack wrote:
> On Friday, 5 March 2021 at 20:10:39 UTC, Max Haughton wrote:
>> On Friday, 5 March 2021 at 20:03:58 UTC, Jack wrote:
>>> On Friday, 5 March 2021 at 09:23:29 UTC, Mike Parker wrote:
>>>> On Friday, 5 March 2021 at 05:31:38 UTC, Jack wrote:
>>>>> [...]
>>>>
>>>> https://dlang.org/blog/2021/03/04/symphony-of-destruction-structs-classes-and-the-gc-part-one/
>>>
>>> thanks for such good article. So if the object was allocated 
>>> on heap, there's no guarantee that the object's destrutor 
>>> will be called at all? do destrutor allocate at stack are 
>>> guarantee to be run?
>>
>> Destructors of structs on the stack will always run 
>> deterministically.
>
> But the ones heap may never run at all, is that right?

You can't rely on the garbage collector for deterministic 
destruction, no.


More information about the Digitalmars-d-learn mailing list