cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: response data received from server

From: Jerry G. Chiuan <jerry_at_oridus.com>
Date: Fri, 12 Sep 2003 14:02:58 -0700

> On Thu, 11 Sep 2003, Jerry G. Chiuan wrote:
>
> > Is it possible that libcurl doesn't delete the buffer, but rather let user
> > application deletes the buffer after it doesn't need it anymore
>
> No. I have an idea of how to reduce one copy from our callback system[*] but
> that's just an idea, far from being implemented.
>
> > By doing that, application can reduce one less copy, especially my data is
> > huge
>
> Keeping huge data in memory is stupid, libcurl will never do that. In most
> applications and systems, the extra copy is not adding much to the general
> speed of the transfer, as the network itself is almost always the bottleneck.
>
> [*] = http://curl.haxx.se/dev/no_copy_callbacks.txt

Hi Daniel,
I found an interesting thing regarding data (pointed by ptr ) passed into the WRITEFUNCTION callback:

size_t write_to_chunk(void *ptr, size_t size, size_t nmemb, void *data)

Originally, I worry about how long the data would be there without being over written ( <- you used to tell me that the buffer is reused )

"You have to copy the data. When you return from the callback, the buffer will be re-used for other purposes."
(<- this is what you mentioned in previous email )

But, I found that the data will be there after the callback returns, until next response comes in and it gets overwritten
It is alive long enough in my case, I can copy data out of the buffer "before the next response is received" ( not that fast before the callback returns)
I thought I have to copy data out of the buffer "right away"

thanks a lot
- Jerry
  

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-12