lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: [lwip] questions & suggestions


From: Adam Dunkels
Subject: [lwip-users] Re: [lwip] questions & suggestions
Date: Thu, 09 Jan 2003 02:14:34 -0000

On Thursday 13 December 2001 08.43, you wrote:
> This is a fragment from your pbuf_alloc() function (see my question in
> comments):
>
>     /* Allocate the tail of the pbuf chain. */
>     r = p;
>     rsize = size - p->len;
>     while(rsize > 0) {
>       q = pbuf_pool_alloc();
>       if(q == NULL) {
>       DEBUGF(PBUF_DEBUG, ("pbuf_alloc: Out of pbufs in pool,\n"));
> #ifdef PBUF_STATS
>         ++stats.pbuf.err;
> #endif /* PBUF_STATS */
>         pbuf_pool_free(p);            /* what if you already allocated
> more than */
>                                               /* one buffer from
> pbuf_pool_alloc_cache - will */
>                                               /* they all be free after
> this call? */
>         return NULL;
>       }

Ok, now I see what you mean. Yes, the whole buffer chain is deallocated by 
pbuf_pool_free(). What it does is that if pbuf_pool_alloc_cache is NULL, 
pbuf_pool_alloc_cache is set to the pbuf chain. If not, the pbuf chain is 
linked to the end of the chain present at pbuf_pool_alloc_cache.

/adam
-- 
Adam Dunkels <address@hidden>
http://www.sics.se/~adam
[This message was sent through the lwip discussion list.]




reply via email to

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