[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] free-ing of pbufs in netif->output function: wh
From: |
leon . woestenberg |
Subject: |
[lwip-users] Re: [lwip] free-ing of pbufs in netif->output function: who's responsible? |
Date: |
Wed, 08 Jan 2003 23:29:34 -0000 |
Hello Paul,
> I was wondering how the pbuf management in the netif drivers should work.
> To be more precise: should the drivers do a pbuf_free on the pbufs that
they
> get passed, or only on the pbufs they allocate themselves? (Currently,
neither
> is done, which is, as far as I can see, wrong anyway).
I do not think this approach is wrong: pbufs are allocated at one level of
the
stack, and deallocated at the other end while they travel through the
stack.
Traffic going from the application to the network (from top to bottom in
the
TCP/IP) stack is allocated by the application, and freed by the application
once it has been passed to UDP or TCP (or any other protocol).
Traffic received by the network interface is allocated by the network
driver and free'd by the receiving application (or by the IP layer if no
receiving application could be found.)
However, in the cs8900a driver which I wrote, I see one possible memory
leak, in cases where the Ethernet header could not be pbuf_header()ed
to the given pbuf of cs8900if_input(). A small (14 bytes) header is added
but never free'd.
Leon.
[This message was sent through the lwip discussion list.]