Add method to use allocator app defaults.

Currently, apps turn off zeroing of memory and enable the decay
timer. For shell commands, set these values when the environment
variable MALLOC_USE_APP_DEFAULTS is set. This fixes performance
differences found between shell spawned command-line tools and
native code running in an app.

Add a unit test to verify setting after exec.

Bug: 302212507

Test: Set the variable to 1 and verified the decay time is enabled.
Test: Set the variable to "" and also unset it and verified the decay
Test: time is not enabled.
Test: Verified that with the variable set, the memory is not zero'd
Test: by default.
Test: Unit tests pass.
Change-Id: I22a47f70f1ce1205c16195532c54b2bf9403e9cd
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
index 7b6d7d4..e2c6eb1 100644
--- a/libc/bionic/malloc_common_dynamic.cpp
+++ b/libc/bionic/malloc_common_dynamic.cpp
@@ -375,7 +375,7 @@
 extern "C" size_t __scudo_get_stack_depot_size();
 
 // Initializes memory allocation framework once per process.
-static void MallocInitImpl(libc_globals* globals) {
+void MallocInitImpl(libc_globals* globals) {
   char prop[PROP_VALUE_MAX];
   char* options = prop;
 
@@ -409,13 +409,6 @@
   }
 }
 
-// Initializes memory allocation framework.
-// This routine is called from __libc_init routines in libc_init_dynamic.cpp.
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
-__LIBC_HIDDEN__ void __libc_init_malloc(libc_globals* globals) {
-  MallocInitImpl(globals);
-}
-
 // =============================================================================
 // Functions to support dumping of native heap allocations using malloc debug.
 // =============================================================================