[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: |
Mumtaz Ahmad |
Subject: |
[lwip-users] Re: [lwip] free-ing of pbufs in netif->output function: who's responsible? |
Date: |
Wed, 08 Jan 2003 22:48:38 -0000 |
This is a multi-part message in MIME format.
------=_NextPart_000_00A6_01C1C14E.EFAC7070
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
free-ing of pbufs in netif->output function: who's responsible?Hi
i think pbufs are always deallocated after calling =20
low_level_output(ethernetif, q); in ethernetif.c
please see the code again
Regads
Mumtaz Ahmad
----- Original Message -----=20
From: Lieverse, Paul=20
To: 'address@hidden'=20
Sent: Friday, March 01, 2002 5:51 PM
Subject: [lwip] free-ing of pbufs in netif->output function: who's =
responsible?
Hi,=20
I was wondering how the pbuf management in the netif drivers should =
work.=20
To be more precise: should the drivers do a pbuf_free on the pbufs =
that they=20
get passed, or only on the pbufs they allocate themselves? (Currently, =
neither=20
is done, which is, as far as I can see, wrong anyway).=20
From the code I understand that:=20
1) TCP/UDP code passes a pbuf pointer to ip_output=20
2) ip_ouput passes this pointer to the netif output function=20
3) eventually, it will be passed to some low_level_output function.=20
Now who is responsible for a pbuf that has been sent out?=20
Some observations:=20
*) tcp_output() and tcp_rst() do a pbuf_free after ip_output()=20
*) tcp_output_segment() and tcp_rexmit_seg() don't do a pbuf_free=20
*) udp_send() doesn't do a pbuf_free either=20
And to make things more complicated:=20
*) In several functions (e.g. in the netif output functions) some =
extra pbuf=20
is allocated and chained at the head of the given pbuf. Noone=20
seems to be free-ing those.=20
So, am I correct that some memory may be leaking here, or am I really=20
missing something?=20
Paul=20
------=_NextPart_000_00A6_01C1C14E.EFAC7070
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>free-ing of pbufs in netif->output function: who's =
responsible?</TITLE>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>i think pbufs are always deallocated =
after=20
calling </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>low_level_output(ethernetif, q); in=20
ethernetif.c</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>please see the code again</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Regads</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Mumtaz Ahmad<BR></DIV></FONT>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A href=3D"mailto:address@hidden"=20
address@hidden>Lieverse, Paul</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
href=3D"mailto:'address@hidden'"=20
address@hidden>'address@hidden'</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, March 01, 2002 =
5:51=20
PM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [lwip] free-ing of =
pbufs in=20
netif->output function: who's responsible?</DIV>
<DIV><BR></DIV>
<P><FONT face=3DArial size=3D2>Hi,</FONT> </P>
<P><FONT face=3DArial size=3D2>I was wondering how the pbuf management =
in the=20
netif drivers should work.</FONT> <BR><FONT face=3DArial size=3D2>To =
be more=20
precise: should the drivers do a pbuf_free on the pbufs that =
they</FONT>=20
<BR><FONT face=3DArial size=3D2>get passed, or only on the pbufs they =
allocate=20
themselves? (Currently, neither</FONT> <BR><FONT face=3DArial =
size=3D2>is done,=20
which is, as far as I can see, wrong anyway).</FONT> </P>
<P><FONT face=3DArial size=3D2>From the code I understand that:</FONT> =
<BR><FONT=20
face=3DArial size=3D2>1) TCP/UDP code passes a pbuf pointer to =
ip_output</FONT>=20
<BR><FONT face=3DArial size=3D2>2) ip_ouput passes this pointer to the =
netif=20
output function</FONT> <BR><FONT face=3DArial size=3D2>3) eventually, =
it will be=20
passed to some low_level_output function.</FONT> </P>
<P><FONT face=3DArial size=3D2>Now who is responsible for a pbuf that =
has been=20
sent out?</FONT> </P>
<P><FONT face=3DArial size=3D2>Some observations:</FONT> <BR><FONT =
face=3DArial=20
size=3D2>*) tcp_output() and tcp_rst() do a pbuf_free after =
ip_output()</FONT>=20
<BR><FONT face=3DArial size=3D2>*) tcp_output_segment() and =
tcp_rexmit_seg() don't=20
do a pbuf_free</FONT> <BR><FONT face=3DArial size=3D2>*) udp_send() =
doesn't do a=20
pbuf_free either</FONT> </P>
<P><FONT face=3DArial size=3D2>And to make things more =
complicated:</FONT>=20
<BR><FONT face=3DArial size=3D2>*) In several functions (e.g. in the =
netif output=20
functions) some extra pbuf</FONT> <BR><FONT face=3DArial =
size=3D2> is=20
allocated and chained at the head of the given pbuf. Noone</FONT> =
<BR><FONT=20
face=3DArial size=3D2> seems to be free-ing those.</FONT> =
</P>
<P><FONT face=3DArial size=3D2>So, am I correct that some memory may =
be leaking=20
here, or am I really</FONT> <BR><FONT face=3DArial size=3D2>missing=20
something?</FONT> </P>
<P><FONT face=3DArial size=3D2>Paul</FONT> =
</P></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_00A6_01C1C14E.EFAC7070--
[This message was sent through the lwip discussion list.]
- [lwip-users] Re: [lwip] free-ing of pbufs in netif->output function: who's responsible?,
Mumtaz Ahmad <=