Something seems… off…about dynamic memory consumption on the PicoPlus2 build. It appears to be consuming upwards of 300KB of dynamic memory (73%) just for a no-library/no-extensions build, where in most other builds the plain build consumes much less. Here’s what I see post-build:
Sketch uses 176788 bytes (2%) of program storage space. Maximum is 8380416 bytes. Global variables use 384296 bytes (73%) of dynamic memory, leaving 139992 bytes for local variables. Maximum is 524288 bytes.
I noticed something similar with “RAM2” consumption on Teensy 4.1 where the build gave me the following stats:
Memory Usage on Teensy 4.1: FLASH: code:137736, data:54428, headers:8536 free for files:7925764 RAM1: variables:58400, code:133896, padding:29944 free for local variables:302048 RAM2: variables:493120 free for malloc/new:31168
Something seems a bit off there too, consuming more than 490KB, leaving only 32k in the pool.
As a contrast, here’s the post-build output of the T-Deck build (those are the three supported devs I have handy, though I probably have dozens around total):
Sketch uses 919005 bytes (70%) of program storage space. Maximum is 1310720 bytes. Global variables use 48984 bytes (14%) of dynamic memory, leaving 278696 bytes for local variables. Maximum is 327680 bytes.
Now, I get it’s apples and oranges to compare ESP32 and ARM builds, but given they’re building the same code with essentially the same functionality, and are all three high-RAM + high-FLASH systems, the different between the ARM results and the ESP32 results are extreme for an area where it seems like all platforms should share similar footprint needs.
Why are global variables consuming only ~50KB of memory on ESP32, yet ~400KB/~500KB respectively for PicoPlus2 & Teensy? That’s a tenfold difference, and I’m having a difficult time justifying even data structure differences that could easily explain why ARM is consuming 10X versus ESP32 in that regard. I could even accept a 2x, maybe even 4x difference as implementation efficiency cost, but not 10x.
So…questions:
-
Can you please explain what all goes into “Global Variables”?
-
Is there any way to get a breakdown report from ULisp on potentially large data structures that might be bloating up that consumption? Kinda guessing not, so in lieu, can you point to whatever section of the code is responsible for defining the “big consumer structures”? I’d like to make sure this isn’t the result of some unintended stray zero or needless “alignment-misalignment” bloat?
-
In absence of hard footprint data, any clue off top of head based on experience with D&I why ARM builds for those two systems are consuming 10X what an ESP32 system (with otherwise similar-sized flash and psram additions) is consuming?
Thanks! Just trying to sort this out because, as you can see, in the Teensy case RAM2 is nearly exhausted, and even in the PicoPlus2 case the remaining variable space is quite limited relative to what the install used.
-John W