void
rspamd_mempool_stat (rspamd_mempool_stat_t * st)
{
- st->pools_allocated = mem_pool_stat->pools_allocated;
- st->pools_freed = mem_pool_stat->pools_freed;
- st->shared_chunks_allocated = mem_pool_stat->shared_chunks_allocated;
- st->bytes_allocated = mem_pool_stat->bytes_allocated;
- st->chunks_allocated = mem_pool_stat->chunks_allocated;
- st->shared_chunks_allocated = mem_pool_stat->shared_chunks_allocated;
- st->chunks_freed = mem_pool_stat->chunks_freed;
- st->oversized_chunks = mem_pool_stat->oversized_chunks;
+ if (mem_pool_stat != NULL) {
+ st->pools_allocated = mem_pool_stat->pools_allocated;
+ st->pools_freed = mem_pool_stat->pools_freed;
+ st->shared_chunks_allocated = mem_pool_stat->shared_chunks_allocated;
+ st->bytes_allocated = mem_pool_stat->bytes_allocated;
+ st->chunks_allocated = mem_pool_stat->chunks_allocated;
+ st->shared_chunks_allocated = mem_pool_stat->shared_chunks_allocated;
+ st->chunks_freed = mem_pool_stat->chunks_freed;
+ st->oversized_chunks = mem_pool_stat->oversized_chunks;
+ }
+}
+
+void
+rspamd_mempool_stat_reset (void)
+{
+ if (mem_pool_stat != NULL) {
+ memset (mem_pool_stat, 0, sizeof (rspamd_mempool_stat_t));
+ }
}
/* By default allocate 8Kb chunks of memory */
*/
void rspamd_mempool_stat (rspamd_mempool_stat_t *st);
+/**
+ * Reset memory pool stat
+ */
+void rspamd_mempool_stat_reset (void);
+
/**
* Get optimal pool size based on page size for this system
* @return size of memory page in system
session->ctx->srv->stat->messages_learned = 0;
session->ctx->srv->stat->connections_count = 0;
session->ctx->srv->stat->control_connections_count = 0;
+ rspamd_mempool_stat_reset ();
}
rspamd_webui_send_ucl (conn_ent, top);