BOZHENG001 commented on issue #1788: URL: https://github.com/apache/mynewt-nimble/issues/1788#issuecomment-2225582230
Hi NimBLE developers, a follow-up of this issue. This issue seems to be caused by memory leak. So, my application allows a BLE device to be both central and peripheral, and each device is allowed to be connected to multiple devices. The data exchange is achieved by write and notify. The number of free memory blocks is known through function `os_msys_num_free()`. When a device is only connected to one device, functions `ble_gattc_write_no_rsp()` and `ble_gatts_notify_custom()` do not lead to the number of free memory blocks changing much. However, once a device is connected to more than 1 device, the number of free memory blocks gradually decreases to 0 for all the devices. The decreasing speed seems to depend on the data exchange frequency and connection interval. For instance, when the data exchange happens every 50 ms and the connection interval is set to 100 ms, the number of free memory blocks decreases to 0 very fast and almost occurs at the beginning of connection establishm ent. However, when the data exchange happens every 100 ms and the connection interval is set to 200 ms, the number of free memory blocks stays stable for a random time period (5 - 60 mins) after connection establishment, and then quickly decreases to 0. To further confirm it, the data exchange happens every 200 ms while the connection interval is set to 50 ms, and the number of free memory blocks still decreases to 0 after a random amount of time after connection establishment. Continuous retransmissions happen when the number of free memory blocks reaches 0, and a reconnection occurs after a certain time period. Function `os_mbuf_free_chain()` has been tried to help with the case; unfortunately, it does not help and will stop the data exchange/connection (Maybe I used the function in a wrong way?). Any possible discussions or suggestions on this issue? Maybe a radio misuse? Or a memory leak? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org