Not enough memory to create sprite
Aleksey Murushkin (Cloverleaf) (8233) 41 posts |
Hi. our ChatCube app sometimes produce error 0×82: Not enough memory to create sprite. I cant find any info about it in docs and what to do with that and how to avoid.
|
Rick Murray (539) 13840 posts |
I don’t know what library you’re using, but something that leaps out at me… Looking at it you are setting used (used?) to the usual offset of 16, and the sprite count to zero. However the first element in the array should be the total size of the sprite area, where is this being set? You are also supposed to initialise the sprite area before creating a sprite: https://www.riscosopen.org/wiki/documentation/show/OS_SpriteOp%209 Set the size of the area, and the offset to the first sprite (16) then call init. It’ll set up the other stuff so you can make use of the sprite area. Why is the header being set as (sprbuffer + 1)? [and one what?] |
Aleksey Murushkin (Cloverleaf) (8233) 41 posts |
this code is works but only sometimes rare happen such errors. |
Stuart Swales (1481) 351 posts |
As Rick says, you MUST initialise the sprite area. Fully. Or you will get unpredictable behaviour. Set sprbuffer→size=total_size and sprbuffer→first=16 before the first spriteop See https://www.riscosopen.org/wiki/documentation/show/Format%20Of%20Sprite%20Area |