mynewt-nimble icon indicating copy to clipboard operation
mynewt-nimble copied to clipboard

Service re-registration leads to increasingly large allocs

Open jimmo opened this issue 5 years ago • 0 comments

hi! I'm from the MicroPython project. We provide a Python API around NimBLE, but we've run into a problem due to the fact that the Python program can be restarted without the board restarting. We do what we can (via the public API) to shutdown and reset NimBLE across these "program resets" but I've just noticed an issue that during service registration we see increasingly large calls to malloc() from ble_gatts_count_cfg().

The cause is that although we call gatts_reset(), nothing resets ble_hs_max_services ble_hs_max_attrs and ble_hs_max_client_configs. I am currently working around this by resetting them from our code.

I think the feature we really want is a global "nimble_reset" function that clears/resets all global variables (i.e. zeros .bss variables and resets .data variables back to default values, as if the board has just restarted).

I understand this is a bit of a weird requirement -- not many implementors of NimBLE would need to register services more than once per hard reset, but would appreciate any suggestions. Thanks!

jimmo avatar Dec 22 '20 01:12 jimmo