lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: [lwip] lwip 0.4.2: missing mem_free() with broadcasts?


From: Adam Dunkels
Subject: [lwip-users] Re: [lwip] lwip 0.4.2: missing mem_free() with broadcasts?
Date: Thu, 09 Jan 2003 00:28:06 -0000

On Wednesday 28 November 2001 10:25, you wrote:
> > Are you allocating heap memory for incoming pbufs (i.e., pbuf type
> > PBUF_RAM)?
>
> Yes ...
>        // ethernet-II ip
>        q = pbuf_alloc(PBUF_RAW, dataLen, PBUF_RAM);
>        if(q != NULL) {
> ? is that a problem ?

It can be since is will call mem_malloc() that in turn will call sem_wait() 
which may block the thread. Also, it may cause memory fragmentation. The pbuf 
pool (type PBUF_POOL) is probably better suited for this, but it will 
allocate a chain of pbufs so that driver will have to be prepared to handle 
this.

Look in src/netif/ethernetif.c for an example of how the pbuf pool might be 
used in a driver.

/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]