mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
7f2c6a9d80
lwip: fix socket memory leak issue 1. Add socket memory leak debug counter 2. Fix TCP PCB leak issue Currently ESP32 support maximum 16 TCP PCBs and all TCP PCB are allocated from heap memory. In some scenario, we may have memory leak issue, for example, the application already created 16 TCP PCB, then it close 5 of them, because the TCP state machine, the LWIP core may not free all the 5 TCP PCB immediately, maybe some is in TIME_WAIT status, some is in FIN_WAIT_1 etc. Then the application try to malloc 17th TCP PCB (the application think they just create 12 because they already close 5), memp_malloc() will return true because the heap is not out of memory, but actually we got 17 TCP PCB. When the scenario repeat again and again (in our Audio application, it repeat more than 10000 times), more and more TCP PCB will be created in the system, each TCP PCB require 200B, then memory leak happen (In Audio application, I saw more than 26 TCP PCB are created, and 10*200=2K memory are leaked). See merge request !223 |
||
---|---|---|
.. | ||
api_lib.c | ||
api_msg.c | ||
err.c | ||
lwip_debug.c | ||
netbuf.c | ||
netdb.c | ||
netifapi.c | ||
pppapi.c | ||
sockets.c | ||
tcpip.c |