Yurik72/ESPHap

Memory leak

Closed this issue · 3 comments

Hi, i am using the function homekit_characteristic_notify() in a loop to inform apple HomeKit
about status changes. After pairing process the Heap memory is decreasing so that the esp32 crashes
after a while.
Any ideas ?
Thanks

Hi, I have deep testing for memory leaks and seems they should not be.. However for clear answer I need your full sketch .
Without that, I haven't any ideas... Maybe you did call this function a lot (frequently), until previous is not finished. So, if you are using homekit_characteristic_notify() in the loop, try any kind of delay to call this function
As well try to call this function if your values is REALLY changed. For instance I have imlemented a macros
HAP_NOTIFY_CHANGES... by using that, it will compare previous value, before sending real request

P.S. be sure that you are using the latest version of library

Yes, you are right. I have implemented a timer to call the update function and it works
without decresing heap memory. Thank you so much.
Chris

Good, seems we can close an issue as well known feathure :)