Thread overview
Unknown bug disallows growth of dynamic arrays
Jun 28, 2021
solidstate1991
Jun 28, 2021
frame
Jun 28, 2021
frame
Jul 01, 2021
solidstate1991
June 28, 2021

Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38

It causes to throw an exception with Access violation reading location and a memory address, int the function _d_arraysetlengthT. Variable ti is a TypeInfo_Array, value of this object is null.

Error happens when adding a sprite in this class: https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixelperfecteditor/src/app.d#L64
However, the same doesn't happen when the editor is being run.

Since leaving out any addition of sprites causes errors elsewhere, I was thinking that it might be a memory leakage issue. Could memory leakage cause such errors when attempting to grow or shrink arrays?

June 28, 2021

On Monday, 28 June 2021 at 20:55:44 UTC, solidstate1991 wrote:

>

Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38

It causes to throw an exception with Access violation reading location and a memory address, int the function _d_arraysetlengthT. Variable ti is a TypeInfo_Array, value of this object is null.

Error happens when adding a sprite in this class: https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixelperfecteditor/src/app.d#L64
However, the same doesn't happen when the editor is being run.

Since leaving out any addition of sprites causes errors elsewhere, I was thinking that it might be a memory leakage issue. Could memory leakage cause such errors when attempting to grow or shrink arrays?

Hmm.. have you enabled bounds checking?

The SpriteLayer.addSprite() method accepts ushort. That's max. 65535. You supply 65_536.
You may have similiar errors in your code.

June 28, 2021

On Monday, 28 June 2021 at 21:45:05 UTC, frame wrote:

>

The SpriteLayer.addSprite() method accepts ushort. That's max. 65535. You supply 65_536.

Ah I mixed the argumets, forget that.
However, your comment

//ocd.objects[65_536]

may also I hint that you try to access elements that are not there.

July 01, 2021

On Monday, 28 June 2021 at 20:55:44 UTC, solidstate1991 wrote:

>

Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38

It causes to throw an exception with Access violation reading location and a memory address, int the function _d_arraysetlengthT. Variable ti is a TypeInfo_Array, value of this object is null.

Error happens when adding a sprite in this class: https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixelperfecteditor/src/app.d#L64
However, the same doesn't happen when the editor is being run.

Since leaving out any addition of sprites causes errors elsewhere, I was thinking that it might be a memory leakage issue. Could memory leakage cause such errors when attempting to grow or shrink arrays?

It seems I could solve the issue with the reserve() function, and it occurred twice so far.

I often have to disable bounds checking, since it takes up precious CPU cycles, instead I do it in an "at once" fashion rather than per-index access, and need to be done in such fashion with the graphics rendering functions I made.