mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-08 22:26:32 +03:00
feat(ble/nimble): support runtime allocation for mempool
This commit is contained in:
@@ -485,6 +485,26 @@ menu "Memory Settings"
|
||||
default 1
|
||||
help
|
||||
This is the service data unit buffer count for l2cap coc.
|
||||
|
||||
config BT_NIMBLE_MEMPOOL_RUNTIME_ALLOC
|
||||
bool "Support on-demand runtime memory allocation for mempool"
|
||||
depends on BT_NIMBLE_ENABLED && !SOC_ESP_NIMBLE_CONTROLLER
|
||||
default n
|
||||
help
|
||||
When this option is enabled, mempool does not require pre-allocating memory.
|
||||
Instead, memory for each block will be dynamically allocated and released
|
||||
during mempool usage. This can significantly reduce memory consumption
|
||||
after mempool initialization, but may have some impact on performance.
|
||||
|
||||
config BT_NIMBLE_MEMPOOL_BLOCK_REUSED
|
||||
bool "Support block reuse for mempool runtime memory allocation"
|
||||
depends on BT_NIMBLE_MEMPOOL_RUNTIME_ALLOC
|
||||
default n
|
||||
help
|
||||
When this option is enabled, dynamically allocated blocks will not be freed
|
||||
but will be reused instead. This ensures virtually no impact on performance
|
||||
while reducing the memory consumption of the mempool.
|
||||
|
||||
endmenu #Memory
|
||||
|
||||
menu "BLE 5.x Features"
|
||||
|
||||
@@ -96,7 +96,11 @@ int ble_hci_trans_hs_cmd_tx(uint8_t *cmd)
|
||||
rc = BLE_HS_ETIMEOUT_HCI;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(MP_RUNTIME_ALLOC)
|
||||
ble_transport_free(BLE_HCI_CMD, cmd);
|
||||
#else
|
||||
ble_transport_free(cmd);
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Submodule components/bt/host/nimble/nimble updated: 8fd41d86c4...c6709f6efa
@@ -2214,4 +2214,20 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_MP_RUNTIME_ALLOC
|
||||
#ifdef CONFIG_BT_NIMBLE_MEMPOOL_RUNTIME_ALLOC
|
||||
#define MYNEWT_VAL_MP_RUNTIME_ALLOC (1)
|
||||
#else
|
||||
#define MYNEWT_VAL_MP_RUNTIME_ALLOC (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_MP_BLOCK_REUSED
|
||||
#ifdef CONFIG_BT_NIMBLE_MEMPOOL_BLOCK_REUSED
|
||||
#define MYNEWT_VAL_MP_BLOCK_REUSED (1)
|
||||
#else
|
||||
#define MYNEWT_VAL_MP_BLOCK_REUSED (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user