lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Freeing memory after http transfer


From: address@hidden
Subject: Re: [lwip-users] Freeing memory after http transfer
Date: Fri, 13 Nov 2009 15:51:18 +0100
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

Bernhard 'Gustl' wrote:
tcp_write is used in my copy too.

Of course it is. The question is whether you pass TCP_WRITE_FLAG_COPY or zero as 4th argument to tcp_write(). If you pass TCP_WRITE_FLAG_COPY, data is copied from the pointer you pass to internal buffers which are freed when ACKed. If you pass zero, data is sent directly from the pointer you supplied ("zero copy").

In the first case (FLAG_COPY), you can free your buffer after passing it to tcp_write(), whereas in the latter (zero), you have to keep the buffer unchanged and allocated until the accumulated count from http_sent() tells you all data has been ACKed.

I don't know whether the version of httpd from 1.3.0 does this correctly or not, but what I do know is that it did have bugs at that time and should not be used in production environment without further testing (it was meant as an example application then). However, I'm in the process of hardening the httpd as I do want to use it in production environment, so you are still having problems with httpd from CVS head, please let me know.

Simon




reply via email to

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