summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/malloc_debug.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-04-01 19:31:26 -0700
committerChristopher Ferris <cferris@google.com>2019-04-02 10:55:21 -0700
commitc328e4465d12d760f5fbcb2daddf5fa4138f50b1 (patch)
treefd91c386332bbe1198cb0bedc11505b76d146057 /libc/malloc_debug/malloc_debug.cpp
parent4699cf61746d37fc11c8eb8bdfc7eb296a476e4b (diff)
Disable info messages by default for malloc debug.
Add a new option verbose for malloc debug that is not enabled by default. This disables all of the info log messages. It turns out these log messages can add a measurable amount of time and can change the boot up. Bug: 129239269 Test: Adjusted unit tests pass. Test: Verified no messages unless verbose option used. Change-Id: I805cb7c8ecb44de88119574e59d784877cacc383
Diffstat (limited to 'libc/malloc_debug/malloc_debug.cpp')
-rw-r--r--libc/malloc_debug/malloc_debug.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index 093bdee8c..114579626 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -30,6 +30,7 @@
#include <inttypes.h>
#include <malloc.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/cdefs.h>
#include <sys/param.h>
@@ -252,6 +253,10 @@ bool debug_initialize(const MallocDispatch* malloc_dispatch, int* malloc_zygote_
// of different error cases.
backtrace_startup();
+ if (g_debug->config().options() & VERBOSE) {
+ info_log("%s: malloc debug enabled", getprogname());
+ }
+
return true;
}