Unknown bug disallows growth of dynamic arrays

frame frame86 at live.com
Mon Jun 28 21:45:05 UTC 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.


More information about the Digitalmars-d-learn mailing list