" bytes in %d partially full chunks",
U64_PRINTF_ARG(bu), U64_PRINTF_ARG(ba), n_used);
bytes_used += bu;
- bytes_allocated += bu;
+ bytes_allocated += ba;
bu = ba = 0;
for (chunk = pool->full_chunks; chunk; chunk = chunk->next) {
++n_full;
" bytes in %d full chunks",
U64_PRINTF_ARG(bu), U64_PRINTF_ARG(ba), n_full);
bytes_used += bu;
- bytes_allocated += bu;
+ bytes_allocated += ba;
log_fn(severity, LD_MM, "Total: "U64_FORMAT"/"U64_FORMAT" bytes allocated "
"for cell pools are full.",
#define assert_active_circuits_ok_paranoid(conn)
#endif
+/** DOCDOC */
+static int total_cells_allocated = 0;
+
#ifdef ENABLE_CELL_POOL
static mp_pool_t *cell_pool = NULL;
/** Allocate structures to hold cells. */
static INLINE void
packed_cell_free(packed_cell_t *cell)
{
+ --total_cells_allocated;
mp_pool_release(cell);
}
static INLINE packed_cell_t *
packed_cell_alloc(void)
{
+ ++total_cells_allocated;
return mp_pool_get(cell_pool);
}
void
dump_cell_pool_usage(int severity)
{
+ circuit_t *c;
+ int n_circs = 0;
+ int n_cells = 0;
+ for (c = _circuit_get_global_list(); c; c = c->next) {
+ n_cells += c->n_conn_cells.n;
+ if (!CIRCUIT_IS_ORIGIN(c))
+ n_cells += TO_OR_CIRCUIT(c)->p_conn_cells.n;
+ ++n_circs;
+ }
+ log(severity, LD_MM, "%d cells allocated on %d circuits. %d cells leaked.",
+ n_cells, n_circs, total_cells_allocated - n_cells);
mp_pool_log_status(cell_pool, severity);
}
#else
static INLINE void
packed_cell_free(packed_cell_t *cell)
{
+ --total_cells_allocated;
tor_free(cell);
}
static INLINE packed_cell_t *
packed_cell_alloc(void)
{
+ ++total_cells_allocated;
return tor_malloc(sizeof(packed_cell_t));
}
void