Page 1 of 1

Suggestions on how to track a memory leak ...

Posted: Fri Dec 09, 2016 4:02 am
by kolban
I find that my app is leaking memory. I am executing a large amount of code (some mine, some third party) in a loop and I have a memory leak. I use the ESP-IDF esp_get_free_heap_size() after every 100 loop iterations and see that the free heap size is steadily decreasing. What I'm looking for is some guidance on how to debug memory leaks in an ESP32 environment. Does anyone have any thoughts on how to find lost heap memory?

Re: Suggestions on how to track a memory leak ...

Posted: Tue Dec 13, 2016 5:13 pm
by arao23
FreeRTOS has pvPortMalloc / vPortFree, and you can trace calls to it with a tool: http://www.freertos.org/trace

Or using macros:
http://www.freertos.org/rtos-trace-macros.html

Re: Suggestions on how to track a memory leak ...

Posted: Wed Dec 14, 2016 1:24 am
by ESP_Sprite
FYI I think I saw a merge request in the queue that fixes this.