On Wed, 21 Jul 2010, Aleksandar Lazic wrote:

Yes, since the application knows how you want the data so it is way better if you allocate or by any other means provide the buffer. If libcurl would do that, you can bet that it won't be enough. An application could use mmap(), malloc(), alloca() or other ways. libcurl could not offer such fancy ways.

Isn't possible to use the

http://curl.haxx.se/libcurl/c/curl_global_init_mem.html

as a possible start for a solution.

I could perhaps, but in my mind I can imagine a program that uses a certain set of malloc()-functions for the ordinary memory handling and it passes those functions in the curl_bloal_init_mem() funciton but it wants _another_ way for the downloaded stream. I think assuming the same malloc for both downloaded data as well as for all the normal mallocs is a bit too limiting.

Like for example, a program may want to use its own mallocs but wants to download directly into a mmap file.

All this said, I would really like to see some actual numbers on how much time anyone actually wastes with this single copy we avoid with this zero copy approach (as it really isn't zero copy, it just avoids one of the many copies that a typical libcurl-based transfer involves).


--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to