Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 528ff17d authored by Martijn Coenen's avatar Martijn Coenen
Browse files

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
parent d519d9c7
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -119,7 +119,6 @@ cc_library_shared {
        "liblog",
        "libcutils",
        "libutils",
        "libutilscallstack",
    ],

    header_libs: [
+0 −2
Original line number Diff line number Diff line
@@ -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 @@ BpMemoryHeap::~BpMemoryHeap() {
                if (VERBOSE) {
                    ALOGD("UNMAPPING binder=%p, heap=%p, size=%zu, fd=%d",
                            binder.get(), this, mSize, heapId);
                    CallStack stack(LOG_TAG);
                }

                munmap(mBase, mSize);
+0 −1
Original line number Diff line number Diff line
@@ -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>