Commit 32f84cf8 authored by Daniel Salzman's avatar Daniel Salzman

conf: fix creeping memory consumption upon reload

parent edda2249
......@@ -30,7 +30,6 @@
#include "contrib/mempattern.h"
#include "contrib/sockaddr.h"
#include "contrib/string.h"
#include "contrib/ucw/mempool.h"
// The active configuration.
conf_t *s_conf;
......@@ -170,7 +169,7 @@ int conf_new(
ret = KNOT_ENOMEM;
goto new_error;
}
mm_ctx_mempool(out->mm, MM_DEFAULT_BLKSIZE);
mm_ctx_init(out->mm);
// Initialize query modules list.
out->query_modules = mm_alloc(out->mm, sizeof(list_t));
......@@ -396,7 +395,6 @@ void conf_free(
}
if (conf->io.zones != NULL) {
trie_free(conf->io.zones);
mm_free(conf->mm, conf->io.zones);
}
conf_mod_load_purge(conf, false);
......@@ -409,7 +407,6 @@ void conf_free(
conf->api->deinit(conf->db);
}
if (conf->mm != NULL) {
mp_delete(conf->mm->ctx);
free(conf->mm);
}
}
......
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -126,12 +126,8 @@ static void reset_buffers(knot_ctl_t *ctx)
static void clean_data(knot_ctl_t *ctx)
{
for (knot_ctl_idx_t i = 0; i < KNOT_CTL_IDX__COUNT; i++) {
if (ctx->data[i] != NULL) {
mm_free(&ctx->mm, (void *)ctx->data[i]);
ctx->data[i] = NULL;
}
}
mp_flush(ctx->mm.ctx);
memset(ctx->data, 0, sizeof(ctx->data));
}
static void close_sock(int *sock)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment