diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-05-28 18:30:47 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-05-30 23:14:33 +0200 |
commit | c4e6968127e876b01e5e0b4b7cdbc49d5267530c (patch) | |
tree | 7d74ba1d30f99ac91b050fbb6c5b44338c56e88f /lib/conncache.c | |
parent | 842f73de58f38bd6e285e08bbd1adb6c17cb62cd (diff) | |
download | curl-c4e6968127e876b01e5e0b4b7cdbc49d5267530c.tar.gz |
url: alloc the download buffer at transfer start
... and free it as soon as the transfer is done. It removes the extra
alloc when a new size is set with setopt() and reduces memory for unused
easy handles.
In addition: the closure_handle now doesn't use an allocated buffer at
all but the smallest supported size as a stack based one.
Closes #5472
Diffstat (limited to 'lib/conncache.c')
-rw-r--r-- | lib/conncache.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/conncache.c b/lib/conncache.c index 95fcea6f3..4474c28b4 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -531,6 +531,11 @@ Curl_conncache_extract_oldest(struct Curl_easy *data) void Curl_conncache_close_all_connections(struct conncache *connc) { struct connectdata *conn; + char buffer[READBUFFER_MIN]; + if(!connc->closure_handle) + return; + connc->closure_handle->state.buffer = buffer; + connc->closure_handle->set.buffer_size = READBUFFER_MIN; conn = conncache_find_first_connection(connc); while(conn) { @@ -547,6 +552,7 @@ void Curl_conncache_close_all_connections(struct conncache *connc) conn = conncache_find_first_connection(connc); } + connc->closure_handle->state.buffer = NULL; if(connc->closure_handle) { SIGPIPE_VARIABLE(pipe_st); sigpipe_ignore(connc->closure_handle, &pipe_st); |