Managing malloced memory
anon
anon at anon.com
Wed Oct 6 19:19:02 UTC 2021
Thanks for the help.
On Wednesday, 6 October 2021 at 18:29:34 UTC, Steven
Schveighoffer wrote:
>You can return this thing and pass it around, and the GC will
>keep it alive until it's not needed. Then on collection, the
>value is freed.
Is the gc required to call ~this() on the struct? I remember it
being implementation defined. Probably doesn't matter for my
usecase, just curious.
>Why is it a problem that it calls the dtor? I thought the whole
>point of refcounting is for the dtor to decrement the refcount,
>and free the malloc'd object only when the refcount has actually
>reached 0.
Yes I'm afraid of double freeing.
More information about the Digitalmars-d-learn
mailing list