Destructor called while object is still alive
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Fri Oct 23 21:14:16 UTC 2020
On Friday, 23 October 2020 at 20:46:13 UTC, frame wrote:
> On Friday, 23 October 2020 at 19:39:52 UTC, Ola Fosheim Grøstad
> wrote:
>> On Friday, 23 October 2020 at 19:23:03 UTC, frame wrote:
>>> So how can I avoid this issue with DMD? Disabling any
>>> optimization? In fact it does not occur with debug mode
>>> enabled.
>>>
>>
>> A dirty fix is to manually add the pointer as a GC root.
>
> Well that works thanks. But shouldn't the runtime do this
> automatically?
No, because it means that the GC will not try to release the
memory...
Maybe cleaner to use a global variable instead?
More information about the Digitalmars-d
mailing list