From 520cf21793e9c6b662c76c02235315f898d10fb9 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 19 Dec 2017 13:53:52 -0500 Subject: Move destroy cells into a separate queue type of their own, to save RAM We've been seeing problems with destroy cells queues taking up a huge amount of RAM. We can mitigate this, since while a full packed destroy cell takes 514 bytes, we only need 5 bytes to remember a circuit ID and a reason. Fixes bug 24666. Bugfix on 0.2.5.1-alpha, when destroy cell queues were introduced. --- src/test/test_circuitmux.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/test') diff --git a/src/test/test_circuitmux.c b/src/test/test_circuitmux.c index b9c0436ebf..130be6fc99 100644 --- a/src/test/test_circuitmux.c +++ b/src/test/test_circuitmux.c @@ -33,8 +33,9 @@ test_cmux_destroy_cell_queue(void *arg) circuitmux_t *cmux = NULL; channel_t *ch = NULL; circuit_t *circ = NULL; - cell_queue_t *cq = NULL; + destroy_cell_queue_t *cq = NULL; packed_cell_t *pc = NULL; + destroy_cell_t *dc = NULL; #ifdef ENABLE_MEMPOOLS init_cell_pool(); @@ -63,11 +64,10 @@ test_cmux_destroy_cell_queue(void *arg) tt_int_op(cq->n, ==, 3); - pc = cell_queue_pop(cq); - tt_assert(pc); - test_mem_op(pc->body, ==, "\x00\x00\x00\x64\x04\x0a\x00\x00\x00", 9); - packed_cell_free(pc); - pc = NULL; + dc = destroy_cell_queue_pop(cq); + tt_assert(dc); + tt_uint_op(dc->circid, ==, 100); + tor_free(dc); tt_int_op(circuitmux_num_cells(cmux), ==, 2); -- cgit v1.2.3-54-g00ecf From cd1f708a7f44ab305c9fcda0060f55f075b98362 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 21 Dec 2017 10:39:29 -0500 Subject: Move free to end of test function so coverity won't complain. --- src/test/test_circuitmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test') diff --git a/src/test/test_circuitmux.c b/src/test/test_circuitmux.c index 130be6fc99..d6b658c27f 100644 --- a/src/test/test_circuitmux.c +++ b/src/test/test_circuitmux.c @@ -67,7 +67,6 @@ test_cmux_destroy_cell_queue(void *arg) dc = destroy_cell_queue_pop(cq); tt_assert(dc); tt_uint_op(dc->circid, ==, 100); - tor_free(dc); tt_int_op(circuitmux_num_cells(cmux), ==, 2); @@ -75,6 +74,7 @@ test_cmux_destroy_cell_queue(void *arg) circuitmux_free(cmux); channel_free(ch); packed_cell_free(pc); + tor_free(dc); #ifdef ENABLE_MEMPOOLS free_cell_pool(); -- cgit v1.2.3-54-g00ecf