Commit 817bab9e authored by Daniel Salzman's avatar Daniel Salzman

zone-update: add heap memory trim to the asynchronous destructor

parent d8a313bf
/* Copyright (C) 2017 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
......@@ -18,7 +18,6 @@
#include <stdint.h>
#include "contrib/mempattern.h"
#include "contrib/trim.h"
#include "dnssec/random.h"
#include "knot/common/log.h"
#include "knot/conf/conf.h"
......@@ -1095,7 +1094,6 @@ int event_refresh(conf_t *conf, zone_t *zone)
return KNOT_EOK;
}
bool bootstrap = zone_contents_is_empty(zone->contents);
try_refresh_ctx_t trctx = { 0 };
// TODO: Flag on zone is ugly. Event specific parameters would be nice.
......@@ -1142,9 +1140,5 @@ int event_refresh(conf_t *conf, zone_t *zone)
zone_events_schedule_at(zone, ZONE_EVENT_NOTIFY, time(NULL) + 1);
}
if (!bootstrap) {
mem_trim();
}
return KNOT_EOK;
}
/* 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
......@@ -17,7 +17,6 @@
#include <assert.h>
#include <stdint.h>
#include "contrib/trim.h"
#include "knot/conf/conf.h"
#include "knot/nameserver/update.h"
#include "knot/zone/zone.h"
......@@ -30,8 +29,5 @@ int event_update(conf_t *conf, zone_t *zone)
/* Process update list - forward if zone has master, or execute. */
updates_execute(conf, zone);
/* Trim extra heap. */
mem_trim();
return KNOT_EOK;
}
/* Copyright (C) 2017 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
......@@ -20,6 +20,7 @@
#include "knot/zone/serial.h"
#include "knot/zone/zone-diff.h"
#include "contrib/mempattern.h"
#include "contrib/trim.h"
#include "contrib/ucw/lists.h"
#include "contrib/ucw/mempool.h"
......@@ -653,6 +654,9 @@ static void callrcu_wrapper_cb(struct rcu_head *param)
free(wrap->ctx);
}
free(wrap);
// Trim extra heap.
mem_trim();
}
/* NOTE: Does nothing if not enough memory. */
......
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