Help request - Bug that only occurs on hardware

Hi everyone,

I’m requesting your help for a bug I can’t get rid of in a game of mine.

Here is the game (a very conventional Tetris clone) :

I have no problem when I run the game in Makecode Arcade’s environment in my browser but when I try the game on hardware (STM32F411) I run into a bug.

Actually, every time I loose I get a 021 error as you can see on the following video.

Does anyone have an idea on what’s wrong with my code ?

021 is the out of memory error:

Most likely what is happening is that the game over screen effect is pushing the game just over the memory limit for that particular device. I’ll have to take a closer look to see if there’s anything that can reduce memory usage in the game - maybe even just clearing a few variables before calling game over would give enough wiggle room ~

Edit: haven’t had a chance to test on hw yet, but clearing the grid array (grid = undefined) before calling game over might be enough?

Thank you for your explanation, your time and advice. I really appreciate.

For now, I just get rid of the game.over instruction. I use game.reset instead and it works fine.

But I’ll go further to clear my variables as you suggested.