[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] how to free udp pcb
From: |
Noam weissman |
Subject: |
Re: [lwip-users] how to free udp pcb |
Date: |
Tue, 26 Feb 2013 08:26:11 +0200 |
Hi Kieran,
I have a new/old problem.
I am running a simple TCP terminal server that works like a telnet server but
with no
Protocol. Actually a s simple TCP server. I use raw TCP terminal.
It works ok but as far as I was able to spot I have memory leaks inside the
LWIP stack.
My server accepts a pBuf and process it.
The transferred data in that pBuf is simple text lines. My server reads char by
char and when it finds CR it
copies this string to a command processor (text parser). This text parser reads
the text and if necessary
sends some data back to the client terminal.
If I pass a large file larger than the command processor queue I need to stall
the pBuf processing until some space
Is freed in the command processor. If all is OK I do not free the accepted pBuf
until It is processed.
That means the original pBuf is not immediately freed and at the same time the
command processor sends data to
The client TCP terminal. The pBuf is eventually freed after all the data is
processed or if there is an error etc…
All is well so far.
If I disconnect the terminal (connected to my server) either in the middle of
the file transfer or even if I wait to the file
End I can do that about more than 15-20 times. I have added error handling,
polling, abort code etc…
Nothing helped and after 20 or something iteration the TCP stoped working.
Although the Stack should free all pBuf’s I added code to free the received
pBuf in case of abort. I also added
Freeing the recived pBuf in all the cases (abort, close or error).
Adding that extra freeing stopped the server from being completely un
responsive but it is not able to send large amount
Of data.
All the above suggests that memory handling is not working properly inside LwIP
and therefore it is leaking.
Normally we work with an older stable version of LWIP (1.32 + FreeRTOS)
I have tried using the latest version 1.41, I even added a few patches and
installed the latest FreeRTOS but it behaves the same.
I feel that something basic is not working properly inside LwIP.
The code is running on STR91 with 96K RAM
I have attached my TCP server source code + lwipopts.h
Any input will help.
Thanks,
Noam.
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Kieran Mansley
Sent: ש 07 ינואר 2012 18:04
To: Mailing list for lwIP users
Subject: Re: [lwip-users] how to free udp pcb
On 6 Jan 2012, at 14:12, Rahul Gundecha wrote:
> In my code, the sockets are closed by calling lwip_close().
lwip_close() should be sufficient if you're using the sockets API. Can you
give more details of what shows that the PCBs are not being freed?
Kieran
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users
************************************************************************************
This footnote confirms that this email message has been scanned by PineApp
Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer
viruses.
************************************************************************************
tcp_term.rar
Description: tcp_term.rar
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [lwip-users] how to free udp pcb,
Noam weissman <=