Open doru91 opened 3 years ago
Regarding large amount of per-fabric RAM data:
Regarding the minimum number of fabrics:
Regarding number of CASE session and ACL entries, this is still being discussed (https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/2551) but at the same time, ACL entries do not necessarily all need to be in RAM all the time if there is an efficient way to cache them in flash to read them "in-place". This would be feasible if the implementation of ACL entry lookup is abstracted in a way that it can be optimized per platform/product.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
On NXP K32W061 (Thread + BLE) I reached a high level of RAM consumption, around 141.5K (Thread FTD). This is distributed as follows:
.heap 61440 bss 75240 .data 1796
HEAP
The main problem is that immediately after I start the device (no BLE/Thread communication available yet) another 30K (!) of RAM are allocated (see the picture below).
At a first glance, the main consumer is the
InitServer()
function, specifically the initialization of each fabrics requires around ~ 1.4K and there are 16 Fabrics (CHIP_CONFIG_MAX_DEVICE_ADMINS
). I guess we don't need 16 Fabrics/device, so I believe this number can be lowered to a more realistic value like 4 Fabrics/device (and we save around 17K of RAM - I see that Qorvo already operated this change). Even with this number:BSS
here are the main consumers:
SECTION: .bss SECTION: .bss 100% 75240 total ├── 18% 13280 _ZN2ot12gInstanceRawE ├── 14% 10371 memp_memory_PBUF_POOL_base ├── 6% 4620 rwip_heap_non_ret ├── 5% 4096 au8PDM_InternalFlashDataBuffer ├── 5% 4096 au8PDM_SegmentDataBuffer ├── 4% 3080 _ZN4chip3app23sInteractionModelEngineE ├── 4% 2960 _ZN12_GLOBAL__N_18gFabricsE ├── 3% 2128 memHeap ├── 3% 2120 _ZN12_GLOBAL__N_19gSessionsE
If the device is downgraded to SED (from FTD) then .bss decreases with around 5K;
OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS is set to the default 44. Each 10 buffers requires ~1.3K of RAM. I believe it really depends on the Thread device used. For an SED, I see that some vendors choose to set this variable to 10 (so _ZN2ot12gInstanceRawE was decreased with around 4K):
In the end, I believe that the current minimal RAM requirements are pretty high for a Matter device and we need to understand better where each byte of memory is consumed.