[Issue 24436] a array be overwritten when other array be written
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 13 09:19:36 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24436
--- Comment #9 from Tim <tim.dlang at t-online.de> ---
Here is a more direct test:
```
import core.memory;
void main()
{
int[][] array1 = new int[][](2,2);
assert(!(GC.getAttr(array1.ptr) & GC.BlkAttr.NO_SCAN)); // fails now
assert(GC.getAttr(array1[0].ptr) & GC.BlkAttr.NO_SCAN); // passes
int*[][] array2 = new int*[][](2,2);
assert(!(GC.getAttr(array2.ptr) & GC.BlkAttr.NO_SCAN)); // passes
assert(!(GC.getAttr(array2[0].ptr) & GC.BlkAttr.NO_SCAN)); // passes
}
```
The attributes are wrong for the outer array of array1. As a result the GC does
not scan it and reuses the memory for the inner arrays.
--
More information about the Digitalmars-d-bugs
mailing list