Remove gMallocLeakZygoteChild.
Remove this global variable and change the setting of it to non-zero
to a call to android_mallopt.
In addition, change the initialize function to use pass a bool* instead of
int*.
Bug: 130028357
Test: Ran malloc_debug/malloc_hooks/perfetto tests.
Change-Id: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6
Merged-In: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6
(cherry picked from commit 5225b342f0810c027df3d09fbbcef4d324b19b93)
diff --git a/libc/bionic/malloc_heapprofd.cpp b/libc/bionic/malloc_heapprofd.cpp
index eda54ce..2aeb9bf 100644
--- a/libc/bionic/malloc_heapprofd.cpp
+++ b/libc/bionic/malloc_heapprofd.cpp
@@ -81,10 +81,10 @@
// In a Zygote child process, this is set to true if profiling of this process
// is allowed. Note that this is set at a later time than the global
-// gMallocLeakZygoteChild. The latter is set during the fork (while still in
+// gZygoteChild. The latter is set during the fork (while still in
// zygote's SELinux domain). While this bit is set after the child is
// specialized (and has transferred SELinux domains if applicable).
-static _Atomic bool gMallocZygoteChildProfileable = false;
+static _Atomic bool gZygoteChildProfileable = false;
extern "C" void* MallocInitHeapprofdHook(size_t);
@@ -114,8 +114,8 @@
static void MaybeInstallInitHeapprofdHook(int) {
// Zygote child processes must be marked profileable.
- if (gMallocLeakZygoteChild &&
- !atomic_load_explicit(&gMallocZygoteChildProfileable, memory_order_acquire)) {
+ if (gZygoteChild &&
+ !atomic_load_explicit(&gZygoteChildProfileable, memory_order_acquire)) {
return;
}
@@ -326,7 +326,7 @@
// Marks this process as a profileable zygote child.
static bool HandleInitZygoteChildProfiling() {
- atomic_store_explicit(&gMallocZygoteChildProfileable, true, memory_order_release);
+ atomic_store_explicit(&gZygoteChildProfileable, true, memory_order_release);
// Conditionally start "from startup" profiling.
if (HeapprofdShouldLoad()) {