View Single Post
Old 02-23-2021, 01:05 AM   #68
stevenaleach
Enthusiast
stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.
 
Posts: 46
Karma: 134116
Join Date: Oct 2013
Device: Android Tablet
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
stevenaleach is offline   Reply With Quote