diff options
author | Daniel Stenberg <daniel@haxx.se> | 2013-04-26 22:23:08 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2013-04-26 22:55:55 +0200 |
commit | 642067287931da64e485e402e5e1fa5096abcddd (patch) | |
tree | f1c843b46447d2e4607bfe029823352932c4d01f /lib/multiif.h | |
parent | c4067a5678321b1755f6027a5c7510b17e7c16a6 (diff) | |
download | curl-642067287931da64e485e402e5e1fa5096abcddd.tar.gz |
curl_easy_init: use less mallocs
By introducing an internal alternative to curl_multi_init() that accepts
parameters to set the hash sizes, easy handles will now use tiny socket
and connection hash tables since it will only ever add a single easy
handle to that multi handle.
This decreased the number mallocs in test 40 (which is a rather simple
and typical easy interface use case) from 1142 to 138. The maximum
amount of memory allocated used went down from 118969 to 78805.
Diffstat (limited to 'lib/multiif.h')
-rw-r--r-- | lib/multiif.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/multiif.h b/lib/multiif.h index 0dcdec76e..799daebcc 100644 --- a/lib/multiif.h +++ b/lib/multiif.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -22,6 +22,8 @@ * ***************************************************************************/ + + /* * Prototypes for library-wide functions provided by multi.c */ @@ -30,6 +32,10 @@ void Curl_expire(struct SessionHandle *data, long milli); bool Curl_multi_pipeline_enabled(const struct Curl_multi* multi); void Curl_multi_handlePipeBreak(struct SessionHandle *data); +/* Internal version of curl_multi_init() accepts size parameters for the + socket and connection hashes */ +struct Curl_multi *Curl_multi_handle(int hashsize, int chashsize); + /* the write bits start at bit 16 for the *getsock() bitmap */ #define GETSOCK_WRITEBITSTART 16 |