[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] free memory.
From: |
David Haas |
Subject: |
[lwip-users] Re: [lwip] free memory. |
Date: |
Wed, 08 Jan 2003 23:27:29 -0000 |
I am doing something similar in my 5272 driver. You can use pbuf->ref to
know when to free the buffer. My low_level_output() function increments
pbuf->ref when the packet is put on the hardware queue. pbuf_free() is
called both from the application and then (presumably later) from the driver
cleanup routine. The last call really frees the buffer, when pbuf->ref is
decremented to zero.
Note that when I did this, I found that I needed better critical region
protection in pbuf.c.
David.
----- Original Message -----
From: "Ñà×Ó" <address@hidden>
To: <address@hidden>
Sent: Friday, December 13, 2002 8:50 PM
Subject: [lwip] free memory.
> hi all,
> I not only queue the packets in the global list "mbox", but also queue
them
> in the waiting list of every interface(I've made some changes of the
"struct netif", and there's a field "if_queue" to hold the packets). The
question takes place--where can I free the buffers(They're malloced by the
user in the application.) I can't let the user free them because when the
output of the interface returns ERR_OK to the user, it only means that the
packet is on the waiting queue of the interface. And it seems there's only
one way out--copy the packets to the queue of the interface, and so the user
can free the buffers when queuing success returns ERR_OK to the user.
> Can anyone give me any other advices?
> denffle
>
> =============================================================
> Ê¡¸ÛÊ¥µ®ÇãÇéÒ¹:Ïã¸Û˧¸ç±¾µØÃÀüÓëÄã½»ÓÑÔ¼»á http://dating.163.com/
> ÍøÒ×¾ãÀÖ²¿ÎªÄ㽨ÔìÒ»¸ö³¬¼¶µÄ˽ÈËÉçÇø£¡ http://our.163.com
> Ãâ·ÑÓÊÏ佡¿µÉ±¶¾´óÐж¯£¡ http://popme.163.com/freemail/index.html
> [This message was sent through the lwip discussion list.]
[This message was sent through the lwip discussion list.]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] Re: [lwip] free memory.,
David Haas <=