I'm trying to port our application which used Bluedroid to nimBLE. I'm working with esp-idf-v4.2.
In my opinion there is a memory leak when nimble is init and deinit if GAP advertizing is used.
I have written a simple code to test it (derived from "bleprph" example). Please find attached the code and my sdkconfig (renamed to .txt to be able to attach).
The test is simple. At start-up nimble is init and esp32 start advertizing.
After 30 seconds advertizing is stopped and nimBLE deinit.
After 30 seconds nimble is init and start advertizing and so on...
Program is working as expected and I can monitor using a "beacon scanner" APP that advertiziing start/stop correctly.
Everytime I init and deinit nimBLE, I print the available heap using function "esp_get_free_heap_size" and as you can see it decreases of 48 bytes each time it is init/deinit.
Code: Select all
W (311) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:240496
W (640) NimBLE_BLE_PRPH: BLE Host Task Started
W (29648) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226452
W (29651) NimBLE_BLE_PRPH: DeINIT BLE OK
W (59651) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254984
W (59911) NimBLE_BLE_PRPH: BLE Host Task Started
W (89918) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226396
W (89921) NimBLE_BLE_PRPH: DeINIT BLE OK
W (119921) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254932
W (120171) NimBLE_BLE_PRPH: BLE Host Task Started
W (150178) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226344
W (150181) NimBLE_BLE_PRPH: DeINIT BLE OK
W (180181) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254884
W (180434) NimBLE_BLE_PRPH: BLE Host Task Started
W (210441) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226296
W (210444) NimBLE_BLE_PRPH: DeINIT BLE OK
W (240444) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254836
W (240694) NimBLE_BLE_PRPH: BLE Host Task Started
W (270702) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226248
W (270705) NimBLE_BLE_PRPH: DeINIT BLE OK
W (300705) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254788
W (300965) NimBLE_BLE_PRPH: BLE Host Task Started
W (330972) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226200
W (330975) NimBLE_BLE_PRPH: DeINIT BLE OK
W (360975) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254740
W (361223) NimBLE_BLE_PRPH: BLE Host Task Started
W (391230) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226152
W (391233) NimBLE_BLE_PRPH: DeINIT BLE OK
W (421233) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254692
W (421498) NimBLE_BLE_PRPH: BLE Host Task Started
W (451506) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226104
W (451509) NimBLE_BLE_PRPH: DeINIT BLE OK
W (481509) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254644
W (481772) NimBLE_BLE_PRPH: BLE Host Task Started
W (511779) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226056
W (511782) NimBLE_BLE_PRPH: DeINIT BLE OK
W (541782) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254596
W (542036) NimBLE_BLE_PRPH: BLE Host Task Started
W (572044) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:226008
W (572047) NimBLE_BLE_PRPH: DeINIT BLE OK
W (602047) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254548
W (602306) NimBLE_BLE_PRPH: BLE Host Task Started
W (632313) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225960
W (632316) NimBLE_BLE_PRPH: DeINIT BLE OK
W (662316) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254500
W (662564) NimBLE_BLE_PRPH: BLE Host Task Started
W (692571) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225912
W (692574) NimBLE_BLE_PRPH: DeINIT BLE OK
W (722574) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254452
W (722828) NimBLE_BLE_PRPH: BLE Host Task Started
W (752835) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225868
W (752838) NimBLE_BLE_PRPH: DeINIT BLE OK
W (782838) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254404
W (783091) NimBLE_BLE_PRPH: BLE Host Task Started
W (813098) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225816
W (813101) NimBLE_BLE_PRPH: DeINIT BLE OK
W (843101) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254356
W (843356) NimBLE_BLE_PRPH: BLE Host Task Started
W (873363) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225768
W (873366) NimBLE_BLE_PRPH: DeINIT BLE OK
W (903366) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254308
W (903618) NimBLE_BLE_PRPH: BLE Host Task Started
W (933625) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225720
W (933628) NimBLE_BLE_PRPH: DeINIT BLE OK
W (963628) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254260
W (963882) NimBLE_BLE_PRPH: BLE Host Task Started
W (993889) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225672
W (993892) NimBLE_BLE_PRPH: DeINIT BLE OK
W (1023892) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254212
W (1024148) NimBLE_BLE_PRPH: BLE Host Task Started
W (1054155) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225624
W (1054158) NimBLE_BLE_PRPH: DeINIT BLE OK
W (1084158) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254164
W (1084411) NimBLE_BLE_PRPH: BLE Host Task Started
W (1114418) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225572
W (1114421) NimBLE_BLE_PRPH: DeINIT BLE OK
W (1144421) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254112
W (1144677) NimBLE_BLE_PRPH: BLE Host Task Started
W (1174684) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225524
W (1174687) NimBLE_BLE_PRPH: DeINIT BLE OK
W (1204687) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254064
W (1204953) NimBLE_BLE_PRPH: BLE Host Task Started
W (1234960) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225476
W (1234963) NimBLE_BLE_PRPH: DeINIT BLE OK
W (1264963) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:254016
W (1265217) NimBLE_BLE_PRPH: BLE Host Task Started
W (1295225) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225432
W (1295228) NimBLE_BLE_PRPH: DeINIT BLE OK
W (1325228) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:253968
W (1325480) NimBLE_BLE_PRPH: BLE Host Task Started
W (1355487) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225384
W (1355490) NimBLE_BLE_PRPH: DeINIT BLE OK
W (1385490) NimBLE_BLE_PRPH: INIT NIMBLE;HEAP:253920
W (1385746) NimBLE_BLE_PRPH: BLE Host Task Started
W (1415753) NimBLE_BLE_PRPH: DEINIT NIMBLE;HEAP:225332
W (1415756) NimBLE_BLE_PRPH: DeINIT BLE OK
Thanks