diff options
author | cebka@mailsupport.rambler.ru <cebka@mailsupport.rambler.ru> | 2008-09-18 19:27:53 +0400 |
---|---|---|
committer | cebka@mailsupport.rambler.ru <cebka@mailsupport.rambler.ru> | 2008-09-18 19:27:53 +0400 |
commit | 2c879bedd2c9b835fb083a152e5f09d48b1dbca6 (patch) | |
tree | 30dfc5cd240481ec6cd7320eb2de79e02017cbf8 /worker.c | |
parent | bb2e8a89d2e4caf5345e565f4da5aeb6fc39655b (diff) | |
download | rspamd-2c879bedd2c9b835fb083a152e5f09d48b1dbca6.tar.gz rspamd-2c879bedd2c9b835fb083a152e5f09d48b1dbca6.zip |
* Add memory pool support.
- memory pools would be used in modules for allocating task specific data without freeing it separately
- memory pools growth is implemented as multiplying by 2 its length (for avoiding multiply reallocs)
- when memory pool is freed all data that was allocated from this pool is freed too
Diffstat (limited to 'worker.c')
-rw-r--r-- | worker.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -97,6 +97,9 @@ free_task (struct worker_task *task) memc_close_ctx (task->memc_ctx); free (task->memc_ctx); } + if (task->task_pool) { + memory_pool_free (task->task_pool); + } while (!TAILQ_EMPTY (&task->urls)) { cur = TAILQ_FIRST (&task->urls); TAILQ_REMOVE (&task->urls, cur, next); @@ -610,6 +613,7 @@ accept_socket (int fd, short what, void *arg) TAILQ_INIT (&new_task->results); TAILQ_INIT (&new_task->parts); new_task->memc_ctx = malloc (sizeof (memcached_ctx_t)); + new_task->task_pool = memory_pool_new (1024); if (new_task->memc_ctx == NULL) { msg_err ("accept_socket: cannot allocate memory for memcached ctx, %m"); } |