ESP32-S2 memory leak
Posted: Mon Feb 05, 2024 3:56 pm
Hi,
We're using LWIP to do async TCP/IP connections. During the development, we've found two memory leaks that we cannot explain; one of them roughly 16 bytes, the other one roughly 1.6 KB
Here are the relevant stack traces:
and:
We're attempting to figure out why the code is leaking, but unfortunately lack the relevant code to properly troubleshoot this. We already confirmed that we call tcp_close (and tcp_abort if that doesn't succeed) on the LWIP connections. Please advice,
Stefan.
We're using LWIP to do async TCP/IP connections. During the development, we've found two memory leaks that we cannot explain; one of them roughly 16 bytes, the other one roughly 1.6 KB
Here are the relevant stack traces:
Code: Select all
Lost ptr=3FFE43B8 size=1696
heap_caps_malloc_base
C:/Espressif/frameworks/esp-idf-v5.1/components/heap/heap_caps.c:178 (discriminator 1)
heap_caps_malloc
C:/Espressif/frameworks/esp-idf-v5.1/components/heap/heap_caps.c:197
heap_caps_malloc_default
C:/Espressif/frameworks/esp-idf-v5.1/components/heap/heap_caps.c:223
malloc
C:/Espressif/frameworks/esp-idf-v5.1/components/newlib/heap.c:24
wifi_malloc
C:/Espressif/frameworks/esp-idf-v5.1/components/esp_wifi/esp32s2/esp_adapter.c:65
esf_buf_alloc_dynamic
??:?
esf_buf_alloc
??:?
wDev_IndicateFrame
??:?
wDev_ProcessRxSucData
??:?
wdevProcessRxSucDataAll
??:?
ppTask
??:?
vPortTaskWrapper
C:/Espressif/frameworks/esp-idf-v5.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162
Code: Select all
Lost ptr=3FFE0238 size=28
heap_caps_malloc_base
C:/Espressif/frameworks/esp-idf-v5.1/components/heap/heap_caps.c:178 (discriminator 1)
heap_caps_malloc
C:/Espressif/frameworks/esp-idf-v5.1/components/heap/heap_caps.c:197
heap_caps_malloc_default
C:/Espressif/frameworks/esp-idf-v5.1/components/heap/heap_caps.c:223
malloc
C:/Espressif/frameworks/esp-idf-v5.1/components/newlib/heap.c:24
mem_malloc
C:/Espressif/frameworks/esp-idf-v5.1/components/lwip/lwip/src/core/mem.c:209
esp_pbuf_allocate
C:/Espressif/frameworks/esp-idf-v5.1/components/esp_netif/lwip/netif/esp_pbuf_ref.c:52
wlanif_input
C:/Espressif/frameworks/esp-idf-v5.1/components/esp_netif/lwip/netif/wlanif.c:151
esp_netif_receive
C:/Espressif/frameworks/esp-idf-v5.1/components/esp_netif/lwip/esp_netif_lwip.c:1221
wifi_sta_receive
C:/Espressif/frameworks/esp-idf-v5.1/components/esp_wifi/src/wifi_netif.c:39
sta_input
??:?
sta_rx_cb
??:?
ppRxPkt
??:?
ppTask
??:?
vPortTaskWrapper
C:/Espressif/frameworks/esp-idf-v5.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162
Stefan.