summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2022-10-13 08:04:14 +0300
committerGitHub <noreply@github.com>2022-10-13 08:04:14 +0300
commit2974f525ec703329ef6ad079d8f6c685cfab11ad (patch)
treeb0e289a5fee787d764ee37cb8b5c2ac7bcd1bd20 /daemon
parentc805a9afad71ac96e703d599cbd6f54c29142ca7 (diff)
overload libc memory allocators with custom ones to trace all allocations (#13810)
* overload libc memory allocators with custom ones to trace all allocations * grab libc pointers for external c plugins * use -ldl when necessary; fallback to work without dlsym when it is not available * initialize global variable * add optional dl libs * dynamically link every library function when needed for the first time * prevent crashes on musl libc * another attempt * dont dereference function * attempt no 3 * attempt no 4 * cleanup - all attempts failed * dont enable tracing of allocations * missing parenthesis
Diffstat (limited to 'daemon')
-rw-r--r--daemon/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/daemon/main.c b/daemon/main.c
index 8f3477ad97..ddbec32408 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -1317,6 +1317,12 @@ int main(int argc, char **argv) {
i = (int)config_get_number(CONFIG_SECTION_GLOBAL, "glibc malloc arena max for netdata", 1);
if(i > 0)
mallopt(M_ARENA_MAX, 1);
+
+
+#ifdef NETDATA_INTERNAL_CHECKS
+ mallopt(M_PERTURB, 0x5A);
+ // mallopt(M_MXFAST, 0);
+#endif
#endif
// initialize the system clocks