libbinder: Don't link against libutilscallstack.
This library can be used for dumping stack backtraces, but it pulls in
a number of dependent libraries that significantly add to the memory
usage of a native process:
virtual shared shared private private
size RSS PSS clean dirty clean dirty swap swapPSS # object
-------- -------- -------- -------- -------- -------- -------- -------- -------- ---- ------------------------------
184 64 9 56 0 0 8 0 0 3 /system/lib64/libartbase.so
104 40 9 32 0 0 8 0 0 3 /system/lib64/libbacktrace.so
276 60 13 48 0 0 12 0 0 3 /system/lib64/libdexfile.so
156 28 5 24 0 0 4 0 0 3 /system/lib64/liblzma.so
332 128 36 96 0 0 32 0 0 3 /system/lib64/libunwindstack.so
28 20 8 12 0 0 8 0 0 3 /system/lib64/libutilscallstack.so
56 28 8 20 0 0 8 0 0 3 /system/lib64/libziparchive.so
These add about 80kB of private dirty memory usage, mostly because
of relocations and some r/w data. Some libraries also allocate data
on the heap on initialization; the total savings appear to be
about ~120kB.
Java processes don't suffer from these issues, because we fork after
relocation and initialization, and much of the data doesn't change
after that; it becomes shared dirty instead of private dirty.
The current cases where CallStack() is used in libbinder don't
warrant increasing native process memory by this much, so remove
them; it's trivial to add them locally for debugging.
Bug: 112073665
Test: builds
Change-Id: I74104b4a8228255fedb4e78b27e38e7cab53225b
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index 6a30956..61b8818 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -119,7 +119,6 @@
"liblog",
"libcutils",
"libutils",
- "libutilscallstack",
],
header_libs: [
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
index 7afec45..507ce53 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -31,7 +31,6 @@
#include <binder/Parcel.h>
#include <log/log.h>
-#include <utils/CallStack.h>
#include <utils/KeyedVector.h>
#include <utils/threads.h>
@@ -264,7 +263,6 @@
if (VERBOSE) {
ALOGD("UNMAPPING binder=%p, heap=%p, size=%zu, fd=%d",
binder.get(), this, mSize, heapId);
- CallStack stack(LOG_TAG);
}
munmap(mBase, mSize);
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index c44a17e..4ba6c2a 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -27,7 +27,6 @@
#include <cutils/properties.h>
#include <utils/String8.h>
#include <utils/SystemClock.h>
-#include <utils/CallStack.h>
#include <private/binder/Static.h>