Program crash: GC destroys an object unexpectedly
eugene
dee0xeed at gmail.com
Thu Sep 23 07:41:13 UTC 2021
On Wednesday, 22 September 2021 at 18:38:34 UTC, Steven
Schveighoffer wrote:
> In terms of any kind of memory management, whether it be ARC,
> manual, GC, or anything else, there will always be pitfalls.
> It's just that you have to get used to the pitfalls and how to
> avoid them.
100% agree.
> I could see a person used to GC complaining that C requires you
> to free every pointer *exactly once*.
C (at compiler level) does not require this.
You can do it free()ly. ,)
With a subsequent... yes, 'shock' after you see 'double free or
corruption' message.
Tell that imaginary person this: if (p) {free(p); p = NULL},
that's all.
More information about the Digitalmars-d-learn
mailing list