Suggestions on how to track a memory leak ...

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Suggestions on how to track a memory leak ...

Postby kolban » Fri Dec 09, 2016 4:02 am

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?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

arao23
Posts: 30
Joined: Tue Dec 13, 2016 4:44 pm

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

Postby arao23 » Tue Dec 13, 2016 5:13 pm

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

ESP_Sprite
Posts: 9014
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Wed Dec 14, 2016 1:24 am

FYI I think I saw a merge request in the queue that fixes this.

Who is online

Users browsing this forum: Google [Bot], RalphD and 106 guests