Can't I allocate at descontructor?
Max Haughton
maxhaton at gmail.com
Fri Mar 5 20:10:39 UTC 2021
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:
>>> The following code returns a memory error. I did notice it
>>> did happens whenever I did a memory allocation. Is this not
>>> possible in the descontrutor? if so, why?
>>
>> 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.
More information about the Digitalmars-d-learn
mailing list