lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] Installed the new version, since allthechangesand turne


From: Kieran Mansley
Subject: RE: [lwip-users] Installed the new version, since allthechangesand turned on the ASSERT debug
Date: Tue, 20 Mar 2007 16:11:59 +0000

On Tue, 2007-03-20 at 15:45 +0000, Joolz [RSD] wrote:
> Do I need to free the data, I thought that would be done by the udp_send

>From doc/rawapi.txt:
- err_t udp_send(struct udp_pcb *pcb, struct pbuf *p)
  Sends the pbuf p. The pbuf is not deallocated.

udp_send() can't free it for you as it has no idea how you allocated it.
For example, the pvMalloc() call above was used to create the payload
area, but lwIP has no idea how to do the opposite of that to release the
memory you've used.

One other thing that concerns me about the above is that it suggests
that you are assuming that by the time the udp_send() call returns,
there will be no further need to access the memory you passed in.
Depending on your hardware, and the driver that sits underneath lwIP,
this might not be the case.  lwIP has finished with it, but the driver
might not have got it onto the wire yet.  However, there's no visible
way to find out when it is safe to free the memory for UDP.  For TCP we
have the "sent" callback.  So not a lot you can do about that, but worth
being careful and making sure it's not a problem for you.

Kieran

  





reply via email to

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