Add a log_allocator_stats_on_exit option.
Running some types of executables, you want to get the stats at
the end of the run. Therefore, add an option to dump the allocator
stats when the program finishes.
Add new unit tests to cover this new option.
Test: All unit tests pass.
Test: Enabled the option, ran getprop and verified that the
Test: log contains the allocator stats.
Change-Id: I1c9f7d5a1fe374e8cfb6ffc8d1caa59064c5d55e
diff --git a/libc/malloc_debug/Config.cpp b/libc/malloc_debug/Config.cpp
index 0d442b4..6be899d 100644
--- a/libc/malloc_debug/Config.cpp
+++ b/libc/malloc_debug/Config.cpp
@@ -212,6 +212,10 @@
"log_allocator_stats_on_signal",
{LOG_ALLOCATOR_STATS_ON_SIGNAL, &Config::VerifyValueEmpty},
},
+ {
+ "log_allocator_stats_on_exit",
+ {LOG_ALLOCATOR_STATS_ON_EXIT, &Config::VerifyValueEmpty},
+ },
};
bool Config::ParseValue(const std::string& option, const std::string& value, size_t min_value,