mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 04:25:32 +00:00
lwip: fix socket memory leak issue
1. Add socket memory leak debug counter 2. Fix TCP PCB leak issue
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/priv/tcp_priv.h"
|
||||
#include "lwip/priv/memp_priv.h"
|
||||
#include "lwip/memp.h"
|
||||
|
||||
#define DBG_LWIP_IP_SHOW(info, ip) printf("%s type=%d ip=%x\n", (info), (ip).type, (ip).u_addr.ip4.addr)
|
||||
#define DBG_LWIP_IP_PCB_SHOW(pcb) \
|
||||
@@ -127,3 +129,22 @@ void dbg_lwip_udp_rxtx_show(void)
|
||||
printf("TBC\n");
|
||||
}
|
||||
|
||||
#if (ESP_CNT_DEBUG == 1)
|
||||
|
||||
uint32_t g_lwip_mem_cnt[MEMP_MAX][2];
|
||||
extern const struct memp_desc * const memp_pools[MEMP_MAX];
|
||||
|
||||
void dbg_lwip_cnt_show(void)
|
||||
{
|
||||
int i=0;
|
||||
|
||||
printf("-----lwip memory counter-----\n");
|
||||
printf("%6s %8s %8s\n", "index", "alloc", "free");
|
||||
for (i=0; i<MEMP_MAX; i++){
|
||||
printf("%6u %8u %8u\n", i, g_lwip_mem_cnt[i][0], g_lwip_mem_cnt[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user