Yurik72 / ESPHap

ESP32/ESP8266 Arduino library for native Apple Homekit Accessory Protocol (HAP)
MIT License
264 stars 60 forks source link

Memory leak #116

Closed ck0567 closed 2 years ago

ck0567 commented 2 years ago

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

Yurik72 commented 2 years ago

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

ck0567 commented 2 years ago

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

Yurik72 commented 2 years ago

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