lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] tcp_pcb_purge() memory leak problem.


From: izumi
Subject: [lwip-users] tcp_pcb_purge() memory leak problem.
Date: Fri, 28 Jan 2011 14:18:03 +0900

Hi, Dear.

Other targets(eg, Windows-PC) repeatedly run 
"connect"->"read/write"->"close"->"connect"... for the lwIP-targets.
The lwIP will not release memory. (MEMP_TCP_SEG)

tcp_pcb_purge () does not free in the case of state/seg/stack-trace to the 
printf() to show up in the console.
As a result, during the following processes, the lwip does not release memory.


+-- lwIP-Target Status ---+
 pcb->state==LAST_ACK

 pcb->ooseq!=NULL
       or
 pcb->unack!=NULL
+-------------------------+
       |
       V
Received ACK from Windows-PC.
       |
       V
tcp_input()

  tcp_process()
     pcb->state=CLOSED

  tcp_pcb_remove(&tcp_active_pcbs, pcb);

     tcp_pcb_purge(pcb);

        But state==CLOSED then not free pcb->ooseq!=NULL or pcb->unack!=NULL



tcp_pcb_purge() statement in the following decision I think should be removed.

  if (pcb->state != CLOSED &&
     pcb->state != TIME_WAIT &&
     pcb->state != LISTEN) {

"pcb->unsent/unacked/ooseq" is initialized to NULL at tcp_alloc().
tcp_pcb_purge() is called at the time, "pcb->unsent/unacked/ooseq !=NULL" means 
that the memory holds.

There is no problem in my environment.

The above is correct?

Izumi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]