Is it possible to get the current memory usage in Arcade?

As the title says, is it possible to get the current memory used in Arcade? (Typescript is fine, but can you do it in Python too? I want to learn Python for Arcade because I’m good at Python…)

And also, is there like a formula for calculating how much memory would be used? Like one 16×16 tile would be 256 bytes (Actually, I’m probably not correct how tilemaps are used, so someone much smarter than me can correct me)? And one sprite would be 20 bytes + image size? And image size (in bytes) would be length × width?

And does Arcade need 92KB of RAM by itself?

Oh, that was a lot of questions…

1 Like

I remember seeing this thread awhile ago: Memory Tools in MakeCode Arcade… which links to this documentation:

I don’t know if this still reflects the state-of-the-art for memory profiling in arcade.

… oh, and I just remembered I think I happened to see @mmoskal demoing it once (a small clip buried inside of a much longer video):

1 Like

Ahh, thank you so much for the video! I saw that before and put it in my program, but I didn’t see it in the console (Arcade one, where you can log stuff, not the browser one) so I gave up on that.

1 Like

The memory dump on console from the videos lists correct sizes for hardware. Images are half byte per pixel plus a few bytes of overhead.

Arcade uses two screen buffers 10k each. There is also a few k for sound support, and a few more for low level system stuff. Most of the rest is for the user program. For realistic games 96k works out to enough.