variants/all: Don't reserve a dedicated mbedTLS heap.#465
Conversation
This patch makes mbedTLS allocate from the libc heap (calloc/free) instead of a dedicated static pool, saving memory for when it's actually needed. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Built
|
| Artifact | Board | Core | Tests | RAM | Sketches | Warnings | Errors |
|---|---|---|---|---|---|---|---|
✅ zephyr_contrib |
ek_ra8d1
| 📗 | ✅ |
11.9% |
2 | - | - |
frdm_mcxn947
| 6 🏷️ | ✅ |
58.0% |
2 | - | - | |
frdm_rw612
| 2 🏷️ | ✅ |
83.0% |
2 | - | - | |
✔️* zephyr_main |
giga
| 4 🏷️ | ✅* |
39.4% |
56 | 16 | - |
nano33ble
| 1 🏷️ | ✅* |
78.8% |
28 | 10 | - | |
nano_matter
| 📗 | ✔️* |
|
20 | 8 | (2*) | |
nicla_vision
| 4 🏷️ | ✔️* |
41.6% |
50 | 8 | (10*) | |
niclasense
| 2 🏷️ | ✅* |
|
26 | 10 | - | |
opta
| 4 🏷️ | ✅* |
41.2% |
60 | 16 | - | |
portentac33
| 3 🏷️ | ✔️* |
80.0% |
62 | 8 | (8*) | |
portentah7
| 3 🏷️ | ✅* |
42.0% |
70 | 16 | - | |
✅* zephyr_unoq |
unoq
| 📗 | ✅* |
26.9% |
74 | 8 | - |
Legend
Board Test Status description 🔥 🔥 Test run failed to complete. ❌ 🔴 Test completed with unexpected errors. ✔️* 🚫 Test completed with errors, but all are known/expected. ✅* 🟡 Test completed with some warnings; no errors detected. ✅ 🟢 Test passed successfully, with no warnings or errors. 🌑 🌑 Test was skipped.
|
Memory usage change @ 0b62dc7
Click for full report table
Click for full report CSV |
|
Not sure this is the right way IMO - while it obviously frees a LOT of RAM for general use ( 😍 ), there's a risk of not being able to allocate the big TLS buffers if the heaps gets fragmented with use before the connection is attempted. I fear connections may work at the beginning, then start to fail over time until a reboot is done. |
This is always a possibility. However, if keep this, we'll always be reserving a large chunk of memory that may never be used. Also, some sketches that don't need networking at all could benefit from this extra memory (for example, LVGL). That all said, I'm fine either way, so I'll let you all decide which way to go. |
|
Half way through between? Like allocate whole TLS heap at startup if something references it? |
|
closind in favour of #512 |
This patch makes mbedTLS allocate from the libc heap (calloc/free) instead of a dedicated static pool, saving memory for when it's actually needed.
Tested on Portenta-C33 and Portenta-H7, can still load full ca bundle from FS and connect run TLS examples.