diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-11-17 11:43:50 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-11-17 11:43:50 -0500 |
commit | 734ba5cb0a0b6cc5376f8889305835224d814252 (patch) | |
tree | 78fa73f2248c8cea20426c5d70c5811d5765de58 /src/or/dirserv.c | |
parent | a68b90fc7af401220f11f4f9e39f08a8548a6957 (diff) | |
download | tor-734ba5cb0a0b6cc5376f8889305835224d814252.tar.gz tor-734ba5cb0a0b6cc5376f8889305835224d814252.zip |
Use smaller zlib objects when under memory pressure
We add a compression level argument to tor_zlib_new, and use it to
determine how much memory to allocate for the zlib object. We use the
existing level by default, but shift to smaller levels for small
requests when we have been over 3/4 of our memory usage in the past
half-hour.
Closes ticket 11791.
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index d31bb72361..635d691afb 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -3182,7 +3182,7 @@ connection_dirserv_add_networkstatus_bytes_to_outbuf(dir_connection_t *conn) if (uncompressing && ! conn->zlib_state && conn->fingerprint_stack && smartlist_len(conn->fingerprint_stack)) { - conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD); + conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD, HIGH_COMPRESSION); } } if (r) return r; |