(March 2024).
Some applications using pixel displays may run out of memory,
especially if you are running on a small ESP32 with no external
PSRAM. This is especially the case if you are using the small
jaguar
server on the device for fast edit-compile-run
development cycles.
Conversely, if you are running on a device with lots of memory you may improve the performance of the pixel display by using larger buffers.
If you run out of memory you will get stack traces and an
overview of memory usage, to help you debug the situation.
Be sure to run jag monitor
or equivalent so that you can
see the debug output in this case. On a base ESP32 with
the default image, the Bluetooth stack takes up a lot of
RAM. This is the case, even if you are not using Bluetooth.
If this is impacting you, you can use an ESP32 envelope
that does not include Bluetooth support. This is done
for a USB-connected device with
jag flash --chip=esp32-no-bt
or for a Wifi connected device with
jag firmware update --chip=esp32-no-bt
Other envelopes with different C components enabled can be found at https://github.com/toitlang/envelopes/releases
If you have a lot of memory and want to use it to improve display performance, you can update the size of the buffers used to update the pixel display to 10k or even more:
display.max-patch-size = 10_000
As I recall it's about 30k of difference, but of course it can vary by version. You can try the recipe above and then run serial-print-heap-report to see how the memory use changes. See https://medium.com/the-toit-take/get-insight-into-memory-use-on-your-esp32-running-toit-65c62e5b65fd