Arrays of noncopyables/Invalid memory operation
ZombineDev via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Feb 17 19:00:10 PST 2016
On Thursday, 18 February 2016 at 01:19:16 UTC, Ali Çehreli wrote:
> On 02/17/2016 05:14 PM, ZombineDev wrote:
>
> > The "Invalid memory operation" error is thrown only by the GC
> (AFAIK)
> > when the user tries something unsupported like allocating or
> freeing in
> > a destructor, while a GC collection is being run.
>
> That. The problem is when the assert check fails (for
> value==60). The GC fails to create the exception object.
>
> Ali
Hmm, why does the destructor of object 60 run in the middle of
nowhere? I remember seeing it crash while my debugger was in
_d_arraysetlengthT [1], though I don't know exactly where because
I didn't have debug symbols for druntime. __doPostblit[2] checks
if the type has disabled this(this) and if so it doesn't do
anything. So the destructor should not have been run because of
the array resize. Seems like there maybe some memory corruption
or a bug in druntime.
[1]:
https://github.com/D-Programming-Language/druntime/blob/e47a00bff935c3f079bb567a6ec97663ba384487/src/rt/lifetime.d#L1265
[2]:
https://github.com/D-Programming-Language/druntime/blob/e47a00bff935c3f079bb567a6ec97663ba384487/src/rt/lifetime.d#L566
More information about the Digitalmars-d-learn
mailing list