Memory Tools in MakeCode Arcade

Hi all,

Are there any plans to implement any tools for visualizing memory usage in the Arcade Simulator? Most of the devices arcade targets have quite limited RAM, and so it would be nice to know the memory footprint of the program without having to leave the simulator.

This could also be extended to a profiler-like tool, so that we can see which categories (e.g. sprites, tiles, arrays) are taking up the most memory, in order to optimize. The tools do not need to be exact, just enough to give a decent estimate of which area is the problem.

Even if the memory allocation is not identical between the browser and the device, this would be a useful indication of any memory bloat.


  • Miles

I agree, Miles, that this would be a nice feature.

The only place where I’ve run into memory problems is when dynamically creating images. Static images - or any other static data in your application, for that matter - are compiled into the “executable” and are not much of a concern. However, when you do something like image.create(screen.width, screen.height), that image is stored on the heap, which is extremely limited on current hardware devices. I’ve found that if you try to create more than two full-screen images, you’ll trip one of the out-of-memory errors on hardware.

It’s not much of an issue when creating objects or even small sprites. You shouldn’t run into memory issues even when creating a couple of hundred objects or a couple of dozen sprites.
Full-screen images, though, occupy a lot of space.

Joey (@jwunderl) put together a few pointers on dealing with the limited memory of hardware.

See the section on error 021: Out of memory: too many objects.

This indeed sounds like a good idea, but it will require quite some work. I’ll take a look in the coming month or two.


To follow up, for some time there’s a low-level support for tracking memory leaks, see here

It uses JS console.

Most likely only in beta beta.


There’s some recent activity in this area in the CircuitPython world: