[feature] Free a little memory used by bluetooth if wifi is enabled or bluetooth is disabled (#10398)

* esp32: release BTDM heap when Bluetooth inactive

Release ESP-IDF BTDM memory after config load when Bluetooth is disabled or WiFi is enabled, recovering heap on ESP32 targets where BLE won’t be used for this boot.

* Address BT memory release review comments

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Clive Blackledge
2026-06-25 17:05:27 -05:00
committed by GitHub
co-authored by GitHub Ben Meadors
parent f1b1e35a79
commit 98fa4a67db
4 changed files with 82 additions and 1 deletions
+1
View File
@@ -1753,6 +1753,7 @@ void disableBluetooth()
#ifdef ARCH_ESP32
if (nimbleBluetooth)
nimbleBluetooth->deinit();
esp32ReleaseBluetoothMemoryIfUnused();
#elif defined(ARCH_NRF52)
if (nrf52Bluetooth)
nrf52Bluetooth->shutdown();