What about the 256KB RAM?

When I have no files on my OpenMV M4 with 256 KB RAM, and a simple program printing allocated and free memory, it gives me following result:

mem_alloc: 448
mem_free: 53568

which in sum are 54016 Bytes. Divided by 1024 that would be 52.75 KB. Where are the other 200 KB?

My code:

import gc
while True:

It’s in something called the frame buffer.

The way the camera is designed, the program is run in something called the CCM (core coupled memory). This is a 128kb bank of RAM on the M7 directly attached to the CPU. We store the .data, .bss, stack, and heap there.

The frambffer, 384kb of RAM, is in another memory region. The frame buffer is split in two parts, the bottom half is where images are stored. The top half is something called the frame buffer stack which allows us to allocate huge amounts of RAM very quickly.

The M4 follows a similar design approach.

So, most of the RAM you can’t touch in Python directly.