lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] socket memory problem


From: yueyue papa
Subject: Re: [lwip-users] socket memory problem
Date: Wed, 24 Dec 2008 13:16:11 +0800

Thanks all

The problem is solved

One task call lwip_read

block in
struct netbuf *
netconn_recv(struct netconn *conn)
{
...
#endif /* LWIP_TCP */
  } else {
#if (LWIP_UDP || LWIP_RAW)
#if LWIP_SO_RCVTIMEO
    if (sys_arch_mbox_fetch(conn->recvmbox, (void *)&buf, conn->recv_timeout)==SYS_ARCH_TIMEOUT) {  <====block here
      buf = NULL;
    }
#else
    sys_arch_mbox_fetch(conn->recvmbox, (void *)&buf, 0);
#endif /* LWIP_SO_RCVTIMEO*/

...
}

Another task called
lwip_close() won't let the netconn_recv exit the block status.

And then our application make force delete task, so one memory is leaked.

As Alain M suggest, we added a timeout for lwip_read, so the block will be exit, and then the block thread won't be killed later.

If lwip_close could wake up the lwip_read is perfect.


On Wed, Dec 24, 2008 at 12:30 AM, Alain M. <address@hidden> wrote:

yueyue papa escreveu:
I am using lwIP socket interface. I meet a kind of memory leak.

My question
1. Whether my flow break the lwIP pre-required  condition.
Already answered by Kieran

2. How could I make quick fixed.
As this problems will happen in almost all platforms, including Linux usualy, what I use to do is: make your socket read non blocking with a "small" timeout, on exit make a loop testing for an abort flag and if requested, cleanup and exit the thread, that is a "normal" way of aborting.

Alain




_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

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