[Issue 21550] core.memory.__delete does not actually work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 15 14:42:41 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21550

Steven Schveighoffer <schveiguy at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at gmail.com

--- Comment #2 from Steven Schveighoffer <schveiguy at gmail.com> ---
To clarify, a new array will be pointing at the front of the block unless the
array size is large enough to be in an extendable block. Last I checked, that
was 2k bytes.

The reason is simple: array size is stored at the end of small blocks for
alignment. But an extendable block can have the block size change from one call
to the next. To avoid issues with that happening, the array size is stored at
the front of the block, pushing the array off by some number of bytes. This
leads to arr.ptr not pointing at the front of the block.

The fix is also simple -- use the info.base just like the original.

--


More information about the Digitalmars-d-bugs mailing list