diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp index 4314dae0b..527a264f6 100644 --- a/adb/daemon/main.cpp +++ b/adb/daemon/main.cpp @@ -19,10 +19,11 @@ #include "sysdeps.h" #include +#include +#include #include #include #include -#include #include #include @@ -213,6 +214,9 @@ int adbd_main(int server_port) { } int main(int argc, char** argv) { + // Set M_DECAY_TIME so that our allocations aren't immediately purged on free. + mallopt(M_DECAY_TIME, 1); + while (true) { static struct option opts[] = { {"root_seclabel", required_argument, nullptr, 's'}, diff --git a/adb/transport_benchmark.cpp b/adb/transport_benchmark.cpp index ffe4cbc8d..da24aa7a7 100644 --- a/adb/transport_benchmark.cpp +++ b/adb/transport_benchmark.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include @@ -171,6 +172,9 @@ ADB_CONNECTION_BENCHMARK(BM_Connection_Echo, ThreadPolicy::SameThread); ADB_CONNECTION_BENCHMARK(BM_Connection_Echo, ThreadPolicy::MainThread); int main(int argc, char** argv) { + // Set M_DECAY_TIME so that our allocations aren't immediately purged on free. + mallopt(M_DECAY_TIME, 1); + android::base::SetMinimumLogSeverity(android::base::WARNING); adb_trace_init(argv); ::benchmark::Initialize(&argc, argv);