summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ctl.c3
-rw-r--r--src/jemalloc.c18
-rw-r--r--src/stats.c1
3 files changed, 22 insertions, 0 deletions
diff --git a/src/ctl.c b/src/ctl.c
index 30704ed..28f4939 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -76,6 +76,7 @@ CTL_PROTO(config_stats)
CTL_PROTO(config_utrace)
CTL_PROTO(config_xmalloc)
CTL_PROTO(opt_abort)
+CTL_PROTO(opt_abort_conf)
CTL_PROTO(opt_retain)
CTL_PROTO(opt_dss)
CTL_PROTO(opt_narenas)
@@ -267,6 +268,7 @@ static const ctl_named_node_t config_node[] = {
static const ctl_named_node_t opt_node[] = {
{NAME("abort"), CTL(opt_abort)},
+ {NAME("abort_conf"), CTL(opt_abort_conf)},
{NAME("retain"), CTL(opt_retain)},
{NAME("dss"), CTL(opt_dss)},
{NAME("narenas"), CTL(opt_narenas)},
@@ -1546,6 +1548,7 @@ CTL_RO_CONFIG_GEN(config_xmalloc, bool)
/******************************************************************************/
CTL_RO_NL_GEN(opt_abort, opt_abort, bool)
+CTL_RO_NL_GEN(opt_abort_conf, opt_abort_conf, bool)
CTL_RO_NL_GEN(opt_retain, opt_retain, bool)
CTL_RO_NL_GEN(opt_dss, opt_dss, const char *)
CTL_RO_NL_GEN(opt_narenas, opt_narenas, unsigned)
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 517fbb9..dd8365f 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -29,6 +29,13 @@ bool opt_abort =
false
#endif
;
+bool opt_abort_conf =
+#ifdef JEMALLOC_DEBUG
+ true
+#else
+ false
+#endif
+ ;
const char *opt_junk =
#if (defined(JEMALLOC_DEBUG) && defined(JEMALLOC_FILL))
"true"
@@ -274,6 +281,9 @@ typedef struct {
# define UTRACE(a, b, c)
#endif
+/* Whether encountered any invalid config options. */
+static bool had_conf_error = false;
+
/******************************************************************************/
/*
* Function prototypes for static functions that are referenced prior to
@@ -847,6 +857,10 @@ malloc_conf_error(const char *msg, const char *k, size_t klen, const char *v,
size_t vlen) {
malloc_printf("<jemalloc>: %s: %.*s:%.*s\n", msg, (int)klen, k,
(int)vlen, v);
+ had_conf_error = true;
+ if (opt_abort_conf) {
+ abort();
+ }
}
static void
@@ -1045,6 +1059,10 @@ malloc_conf_init(void) {
}
CONF_HANDLE_BOOL(opt_abort, "abort")
+ CONF_HANDLE_BOOL(opt_abort_conf, "abort_conf")
+ if (opt_abort_conf && had_conf_error) {
+ abort();
+ }
CONF_HANDLE_BOOL(opt_retain, "retain")
if (strncmp("dss", k, klen) == 0) {
int i;
diff --git a/src/stats.c b/src/stats.c
index b67d46d..48d3f59 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -813,6 +813,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
"Run-time option settings:\n");
}
OPT_WRITE_BOOL(abort, ",")
+ OPT_WRITE_BOOL(abort_conf, ",")
OPT_WRITE_BOOL(retain, ",")
OPT_WRITE_CHAR_P(dss, ",")
OPT_WRITE_UNSIGNED(narenas, ",")