Commit 3b9f757e authored by Jan Včelák's avatar Jan Včelák 🚀

mempattern: move trim to server

parent 17fe12c3
......@@ -94,7 +94,8 @@ libknots_la_SOURCES = \
common-knot/strlcat.h \
common-knot/strlcpy.c \
common-knot/strlcpy.h \
common-knot/strtonum.h
common-knot/strtonum.h \
common-knot/trim.h
# static: common shared (also in libknot)
libknotcs_la_SOURCES = \
......
/* Copyright (C) 2014 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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifdef HAVE_MALLOC_TRIM
#include <malloc.h>
#endif
/*!
* \brief Trim excess heap memory.
*/
static inline void mem_trim(void)
{
#ifdef HAVE_MALLOC_TRIM
malloc_trim(0);
#endif
}
......@@ -21,6 +21,7 @@
#include <errno.h>
#include <assert.h>
#include "common-knot/trim.h"
#include "knot/knot.h"
#include "knot/server/server.h"
#include "knot/server/udp-handler.h"
......
......@@ -18,6 +18,7 @@
#include <time.h>
#include "common-knot/evsched.h"
#include "common-knot/trim.h"
#include "common/mempool.h"
#include "knot/server/server.h"
#include "knot/server/udp-handler.h"
......
......@@ -22,6 +22,7 @@
#include "libknot/descriptor.h"
#include "common-knot/evsched.h"
#include "common-knot/lists.h"
#include "common-knot/trim.h"
#include "knot/zone/node.h"
#include "knot/zone/zone.h"
#include "knot/zone/zonefile.h"
......
......@@ -19,9 +19,6 @@
#include <string.h>
#include <sys/resource.h>
#include <stdarg.h>
#ifdef HAVE_MALLOC_TRIM
#include <malloc.h>
#endif /* HAVE_MALLOC_TRIM */
#include "libknot/mempattern.h"
#include "common/mempool.h"
......@@ -203,11 +200,3 @@ void usage_dump()
usage.ru_nivcsw);
fprintf(stderr, "==================\n");
}
/*! \brief Trim excess heap memory. */
void mem_trim(void)
{
#ifdef HAVE_MALLOC_TRIM
malloc_trim(0);
#endif
}
......@@ -119,7 +119,5 @@ char* strcdup(const char *s1, const char *s2);
*/
void usage_dump();
/*! \brief Trim excess heap memory. */
void mem_trim(void);
/*! @} */
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