Can't I allocate at descontructor?

evilrat evilrat666 at gmail.com
Fri Mar 5 05:42:03 UTC 2021


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?
>

GC prohibits allocation during collection, since this dtor is 
likely called by GC this is what happens.

If you REALLY need this just allocate using other mechanisms.


More information about the Digitalmars-d-learn mailing list