There's global variable called `malloc_conf` that can be used to
configure jemalloc behaviour at the program startup. We use following
configuration:
* xmalloc:true - abort-on-out-of-memory enabled.
* background_thread:true - Enable internal background worker threads
to handle purging asynchronously.
* metadata_thp:auto - allow jemalloc to use transparent huge page
(THP) for internal metadata initially, but may begin to do so when
metadata usage reaches certain level.
* dirty_decay_ms:30000 - Approximate time in milliseconds from the
creation of a set of unused dirty pages until an equivalent set of
unused dirty pages is purged and/or reused.
* muzzy_decay_ms:30000 - Approximate time in milliseconds from the
creation of a set of unused muzzy pages until an equivalent set of
unused muzzy pages is purged and/or reused.
More information about the specific meaning can be found in the jemalloc
manpage or online at http://jemalloc.net/jemalloc.3.html
#include <json_object.h>
#endif /* HAVE_JSON_C */
+#include <jemalloc/jemalloc.h>
+
#include "mem_p.h"
#define MCTXLOCK(m) LOCK(&m->lock)
static void
mem_initialize(void) {
+ malloc_conf = "xmalloc:true,background_thread:true,metadata_thp:auto,"
+ "dirty_decay_ms:30000,muzzy_decay_ms:30000";
+
isc_mutex_init(&contextslock);
ISC_LIST_INIT(contexts);
totallost = 0;