[Issue 21550] core.memory.__delete does not actually work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 15 01:21:23 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21550
--- Comment #1 from Adam D. Ruppe <destructionator at gmail.com> ---
BTW also this page: https://dlang.org/deprecate.html#delete says to call
GC.free instead. This is incorrect as GC.free(arr.ptr) is a do-nothing
operation. You MUST get the base of the block.
I'm slightly concerned that the block might be shared with some other array....
is there ever a case where two small `new` allocated arrays would ever share a
GC block? Of course I know other slices can use it, but that's expected, I'm
just concerned about surprising action at a distance.
If that never happens, just doing GC.free(GC.addrOf(ptr)) I believe is an
acceptable fix in both __Delete's impl and in that documentation page's
suggestion.
--
More information about the Digitalmars-d-bugs
mailing list