From 00e40aac285191a7dae8a8a66e068247fedca52f Mon Sep 17 00:00:00 2001 From: Howard Wu <40033067+Howard20181@users.noreply.github.com> Date: Fri, 3 Sep 2021 22:09:25 +0800 Subject: [PATCH] Reduce the buffer size again in Release to the default value (#1043) --- core/src/main/cpp/daemon/logcat.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/cpp/daemon/logcat.cpp b/core/src/main/cpp/daemon/logcat.cpp index e590f4fd..9cfe0749 100644 --- a/core/src/main/cpp/daemon/logcat.cpp +++ b/core/src/main/cpp/daemon/logcat.cpp @@ -12,6 +12,12 @@ using namespace std::string_view_literals; constexpr size_t kMaxLogSize = 4 * 1024 * 1024; +#ifndef NDEBUG + constexpr size_t kLogBufferSize = 1 * 1024 * 1024; +#else + constexpr size_t kLogBufferSize = 256 * 1024; +#endif + constexpr std::array kLogChar = { /*ANDROID_LOG_UNKNOWN*/'?', /*ANDROID_LOG_DEFAULT*/ '?', @@ -158,7 +164,7 @@ void Logcat::Run() { for (log_id id:{LOG_ID_MAIN, LOG_ID_CRASH}) { auto *logger = android_logger_open(logger_list.get(), id); if (logger == nullptr) continue; - android_logger_set_log_size(logger, kMaxLogSize); + android_logger_set_log_size(logger, kLogBufferSize); } struct log_msg msg{};