On 18 Jun 2012, at 15:31, Justin Drake wrote:

> I am a function to send data packets. Each time a packet is receive, I create 
> a buffer using `pbuf_alloc`. I then send the packet using `upd_sendto`. 
> Finally, I free the buffer with `pbuf_free`.
> 
> For some reason, `pbuf_free` is not freeing the buffers. (I get a buffer 
> overflow after `n` packets, where `n` is the pool size.)
> 
> How can I have `pbuf_free` actually free my buffers? How is the buffer 
> overflow avoided?

pbufs are reference counted, so that many code paths can say "I'm using this, 
don't free it yet" and it is not until they all call  pbuf_free that is 
actually deallocated.  I would look into that.  My first guess is that lwIP or 
the driver was taking a reference to prevent it being freed if it couldn't 
immediately be sent on the wire, but I can't see that in the code for UDP.

Kieran
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to