From bfa808d68997d74bfe0d54196bbbb649646787c1 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 27 Sep 2017 19:22:59 +0300 Subject: Event engine memory cache for nxt_sockaddr_t. Introducing event engine memory cache and using the cache for nxt_sockaddr_t structures. --- src/nxt_controller.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nxt_controller.c') diff --git a/src/nxt_controller.c b/src/nxt_controller.c index c8bfbad6..d7a3d1a7 100644 --- a/src/nxt_controller.c +++ b/src/nxt_controller.c @@ -118,10 +118,18 @@ nxt_controller_start(nxt_task_t *task, void *data) nxt_str_t *json; nxt_runtime_t *rt; nxt_conf_value_t *conf; + nxt_event_engine_t *engine; nxt_http_fields_hash_t *hash; rt = task->thread->runtime; + engine = task->thread->engine; + + engine->mem_pool = nxt_mp_create(4096, 128, 1024, 64); + if (nxt_slow_path(engine->mem_pool == NULL)) { + return NXT_ERROR; + } + hash = nxt_http_fields_hash_create(nxt_controller_request_fields, rt->mem_pool); if (nxt_slow_path(hash == NULL)) { @@ -686,6 +694,8 @@ nxt_controller_conn_free(nxt_task_t *task, void *obj, void *data) nxt_debug(task, "controller conn free"); + nxt_sockaddr_cache_free(task->thread->engine, c); + nxt_mp_destroy(c->mem_pool); //nxt_free(c); -- cgit