The first step towards adding a guardrail.
Added a malloc debug cmd to find memory leak and where
the most heap allocations are with backtrace.
More info: malloc_debug/README.md
The util class is borrowed from audio server.
Usage:
adb shell stop
adb shell setprop libc.debug.malloc.program statsd
adb shell setprop libc.debug.malloc.options backtrace
adb shell start
adb shell cmd stats meminfo
Also,
adb shell dumpsys meminfo [statsd_pid]
also gives you the overall summary of the memory usage.
Test: manual
Change-Id: I4eb4167466a748ea0c3d9fd39e45d9900bc00fc2
diff --git a/cmds/statsd/Android.mk b/cmds/statsd/Android.mk
index d860363..c4b34ca 100644
--- a/cmds/statsd/Android.mk
+++ b/cmds/statsd/Android.mk
@@ -56,7 +56,8 @@
src/storage/DropboxWriter.cpp \
src/StatsLogProcessor.cpp \
src/StatsService.cpp \
- src/stats_util.cpp
+ src/stats_util.cpp \
+ src/guardrail/MemoryLeakTrackUtil.cpp
statsd_common_c_includes := \
$(LOCAL_PATH)/src \
@@ -83,7 +84,8 @@
libhidltransport \
libhwbinder \
android.hardware.power@1.0 \
- android.hardware.power@1.1
+ android.hardware.power@1.1 \
+ libmemunreachable
# =========
# statsd