[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] TCP bandwidth limited by rate of ACKs
From: |
Mason |
Subject: |
Re: [lwip-users] TCP bandwidth limited by rate of ACKs |
Date: |
Tue, 18 Oct 2011 10:47:34 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20110928 Firefox/7.0.1 SeaMonkey/2.4.1 |
Simon wrote:
> Mason wrote:
>
>> I tried using the Netconn API because I thought it didn't
>> force a memcpy (is that correct?), but I can't get it to work.
>
> Yes, that's correct. From your example, I guess you're running out of
> netbufs: if netconn_recv returns success, it passes you a netbuf (the RX
> data) and it's up to your application to free the buffer when you're
> done with it.
>
>> struct netconn *conn = netconn_new( NETCONN_TCP );
>> netconn_bind(conn, IP_ADDR_ANY, 44044);
>> netconn_listen(conn);
>> while ( 1 )
>> {
>> struct netconn *foo;
>> netconn_accept(conn,&foo);
>> while ( 1 )
>> {
>> struct netbuf *buf;
>> err = netconn_recv(foo,&buf);
>> if (err) { printf("recv=%d\n", err); break; }
>
> --> Add netbuf_free(buf); here
>
>> }
>> netconn_delete(foo);
>> }
I must be missing something, because it looks like there's a small
memory leak: netconn_recv allocates memory for a struct netbuf
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
but netbuf_free does not free this memory
void netbuf_free(struct netbuf *buf)
{
if (buf->p != NULL) { pbuf_free(buf->p); }
buf->p = buf->ptr = NULL;
}
Am I supposed to call netbuf_delete instead?
http://lwip.wikia.com/wiki/Netbuf_delete
void netbuf_delete(struct netbuf *buf)
{
if (buf != NULL) {
if (buf->p != NULL) {
pbuf_free(buf->p);
buf->p = buf->ptr = NULL;
}
memp_free(MEMP_NETBUF, buf);
}
}
--
Regards.
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, (continued)
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Mason, 2011/10/11
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Kieran Mansley, 2011/10/11
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Mason, 2011/10/12
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Bill Auerbach, 2011/10/12
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Mason, 2011/10/12
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, address@hidden, 2011/10/12
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Mason, 2011/10/13
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, address@hidden, 2011/10/13
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Mason, 2011/10/17
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, address@hidden, 2011/10/17
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs,
Mason <=
- Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Simon Goldschmidt, 2011/10/18
Re: [lwip-users] TCP bandwidth limited by rate of ACKs, Bill Auerbach, 2011/10/10