summaryrefslogtreecommitdiffstats
path: root/libmemunreachable
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-05-17 16:11:53 -0700
committerColin Cross <ccross@android.com>2018-05-17 16:17:28 -0700
commit18f368560090619bb4284a408262feb86c747002 (patch)
tree48f57ae54016bd7645990fb1f95f5cc7f8d5097e /libmemunreachable
parent3464bc4b439e01244c0a6b5f35e8e949e0f16096 (diff)
downloadsystem_core-18f368560090619bb4284a408262feb86c747002.tar.gz
system_core-18f368560090619bb4284a408262feb86c747002.tar.bz2
system_core-18f368560090619bb4284a408262feb86c747002.zip
Document using libmemunreachable on an app
Document dumpsys meminfo --unreachable, and how to enable malloc_debug backtraces on a single app. Test: none Change-Id: I649afdfff1c7438f74950395639b06c39cae3ca0
Diffstat (limited to 'libmemunreachable')
-rw-r--r--libmemunreachable/README.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/libmemunreachable/README.md b/libmemunreachable/README.md
index ae8fa94b3..6d9141a5f 100644
--- a/libmemunreachable/README.md
+++ b/libmemunreachable/README.md
@@ -12,6 +12,27 @@ In the default (zero-overhead) mode, the returned data on leaks is limited to th
Usage
-------
+### In Android apps ###
+
+libmemunreachble is loaded by zygote and can be triggered with `dumpsys -t 600 meminfo --unreachable [process]`.
+
+To enable malloc\_debug backtraces on allocations for a single app process on a userdebug device, use:
+```
+adb root
+adb shell setprop libc.debug.malloc.program app_process
+adb shell setprop wrap.[process] "\$\@"
+adb shell setprop libc.debug.malloc.options backtrace=4
+```
+
+Kill and restart the app, trigger the leak, and then run `dumpsys -t 600 meminfo --unreachable [process]`.
+
+To disable malloc\_debug:
+```
+adb shell setprop libc.debug.malloc.options "''"
+adb shell setprop libc.debug.malloc.program "''"
+adb shell setprop wrap.[process] "''"
+```
+
### C interface ###
#### `bool LogUnreachableMemory(bool log_contents, size_t limit)` ####