This is just a possibility,but: When you close a TCP socket, LWIP needs to keep the socket around in the TIME_WAIT state until it knows the socket is closed at the other end.
This list shouldn't be bounded by size though, as far as I know it's only bounded by time. But if you are creating/deleting sockets on a regular basis, it may be that "10 sockets" is the amount of time it takes to timeout one socket.
TLS storing previous connection information
Re: TLS storing previous connection information
The reason why 84 bytes are not freed when you close the socket is that LWIP allocates a mutex for use with each socket structure the first time the socket is opened and intentionally does not free that mutex. Look for the comment /* one time init and never free */ in esp-idf/components/lwip/api/sockets.c
The reason why this memory "leak" stops after the 10th time is that the default configuration (which you can change in menuconfig) provides space for 10 socket structures. LWIP follow as policy of not reusing a socket number and its associated structure so long as there is a never-used one still available. After all 10 have been used, then it will reuse one. In that case, the mutex will have already been allocated.
The reason why this memory "leak" stops after the 10th time is that the default configuration (which you can change in menuconfig) provides space for 10 socket structures. LWIP follow as policy of not reusing a socket number and its associated structure so long as there is a never-used one still available. After all 10 have been used, then it will reuse one. In that case, the mutex will have already been allocated.
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot], ok-home and 68 guests