summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-08-19 10:59:15 -0400
committerNick Mathewson <nickm@torproject.org>2014-08-24 13:04:27 -0400
commit8e55cafd672353979e7628d5dad9e12429b401dd (patch)
tree5c21280017363ee9b31356013d7ab5961bfa4f04 /src/or
parentec59167cae1f5b3057ed722857d78ec78239e991 (diff)
downloadtor-8e55cafd672353979e7628d5dad9e12429b401dd.tar.gz
tor-8e55cafd672353979e7628d5dad9e12429b401dd.zip
Count zlib buffer memory towards OOM totals.
Part of 11792. (Uses the zlib-endorsed formula for memory needs for inflate/deflate from "zconf.h".)
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitlist.c8
-rw-r--r--src/or/relay.c1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 9aeb3eb19a..c738f9357f 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -1811,6 +1811,14 @@ marked_circuit_single_conn_free_bytes(connection_t *conn)
result += buf_allocation(conn->outbuf);
buf_clear(conn->outbuf);
}
+ if (conn->type == CONN_TYPE_DIR) {
+ dir_connection_t *dir_conn = TO_DIR_CONN(conn);
+ if (dir_conn->zlib_state) {
+ result += tor_zlib_state_size(dir_conn->zlib_state);
+ tor_zlib_free(dir_conn->zlib_state);
+ dir_conn->zlib_state = NULL;
+ }
+ }
return result;
}
diff --git a/src/or/relay.c b/src/or/relay.c
index f42602d412..7d7ef7a835 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -2433,6 +2433,7 @@ cell_queues_check_size(void)
{
size_t alloc = cell_queues_get_total_allocation();
alloc += buf_get_total_allocation();
+ alloc += tor_zlib_get_total_allocation();
if (alloc >= get_options()->MaxMemInQueues) {
circuits_handle_oom(alloc);
return 1;