project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.34k stars 1.97k forks source link

ESP32 BLEManagerImpl not releasing BT memory when already provisioned #23042

Closed stevegrau-ayla closed 1 year ago

stevegrau-ayla commented 1 year ago

There should be a call to esp_bt_mem_release(ESP_BT_MODE_BTDM) here and in the thread case, as well.

https://github.com/project-chip/connectedhomeip/blob/f1bbff3912e3910e09242dc331bd650f2a0c5564/src/platform/ESP32/nimble/BLEManagerImpl.cpp#L153

dhrishi commented 1 year ago

@stevegrau-ayla Yes, you are right. A call to esp_bt_mem_release(ESP_BT_MODE_BTDM) should be added. Note that, this is required only in the case of ESP32 and not for other SoCs like ESP32-C3/C2/H2.

Thanks for reporting. We will fix this.

stevegrau-ayla commented 1 year ago

For the other chips, it would be very helpful if the ESP-IDF were updated to release the bss and data segments for the the BT stacks, as it does with the ESP32. I understand on the newer chips the BT controller memory can't be released but it seems like releasing the bss and data segments should still be possible. There's a significant amount of memory and a lot of IoT use cases that use BT for provisioning only.