And... my Python example was terrible... the absurd overhead on the byte array came from creating a list first unnecessarily... so here's a less bone-headed example that just allocates 2MB of ram.... yay.. nothing special needed be done, it just allocates a block of memory roughly four times what the ESP-32 has on tap sans SPRAM.
>>> import gc
>>> gc.mem_free()
4096944
>>> buff = bytearray(1024*1024*2)
>>> len(buff) / (1024)
2048.0
>>> gc.mem_free()
1999216
|