summaryrefslogtreecommitdiffstats
path: root/include/jemalloc
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2019-03-19 23:04:35 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2019-04-15 23:48:12 (GMT)
commitf4d24f05e1f270c43bc4129c0d18d673b8ac85b8 (patch)
tree4e3e0d1ae1f5c496a889ec13691bc6c090d7f8fb /include/jemalloc
parent7f7935cf7805036d42fb510592ab8b40bcfb0690 (diff)
downloadjemalloc-f4d24f05e1f270c43bc4129c0d18d673b8ac85b8.zip
jemalloc-f4d24f05e1f270c43bc4129c0d18d673b8ac85b8.tar.gz
jemalloc-f4d24f05e1f270c43bc4129c0d18d673b8ac85b8.tar.bz2
Move extra size checks behind a config flag.
This will let us turn that flag into a generic "turn on runtime checks" flag that guards other functionality we have planned.
Diffstat (limited to 'include/jemalloc')
-rw-r--r--include/jemalloc/internal/jemalloc_internal_defs.h.in4
-rw-r--r--include/jemalloc/internal/jemalloc_preamble.h.in19
2 files changed, 21 insertions, 2 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in
index 21b6514..c442a21 100644
--- a/include/jemalloc/internal/jemalloc_internal_defs.h.in
+++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in
@@ -360,7 +360,7 @@
*/
#undef JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE
-/* Performs additional size-matching sanity checks when defined. */
-#undef JEMALLOC_EXTRA_SIZE_CHECK
+/* Performs additional safety checks when defined. */
+#undef JEMALLOC_OPT_SAFETY_CHECKS
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
diff --git a/include/jemalloc/internal/jemalloc_preamble.h.in b/include/jemalloc/internal/jemalloc_preamble.h.in
index 4bfdb32..9fd2a7f 100644
--- a/include/jemalloc/internal/jemalloc_preamble.h.in
+++ b/include/jemalloc/internal/jemalloc_preamble.h.in
@@ -161,6 +161,25 @@ static const bool config_log =
false
#endif
;
+/*
+ * Are extra safety checks enabled; things like checking the size of sized
+ * deallocations, double-frees, etc.
+ */
+static const bool config_opt_safety_checks =
+#if defined(JEMALLOC_EXTRA_SAFETY_CHECKS)
+ true
+#elif defined(JEMALLOC_DEBUG)
+ /*
+ * This lets us only guard safety checks by one flag instead of two; fast
+ * checks can guard solely by config_opt_safety_checks and run in debug mode
+ * too.
+ */
+ true
+#else
+ false
+#endif
+ ;
+
#if defined(_WIN32) || defined(JEMALLOC_HAVE_SCHED_GETCPU)
/* Currently percpu_arena depends on sched_getcpu. */
#define JEMALLOC_PERCPU_ARENA