1 diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc
2 index 9d12c42..900ab13 100644
3 --- a/base/process/process_metrics_posix.cc
4 +++ b/base/process/process_metrics_posix.cc
5 @@ -119,14 +119,14 @@ size_t ProcessMetrics::GetMallocUsage() {
6 malloc_statistics_t stats = {0};
7 malloc_zone_statistics(nullptr, &stats);
8 return stats.size_in_use;
9 -#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
10 +#elif defined(__GLIBC__) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
11 struct mallinfo minfo = mallinfo();
12 #if BUILDFLAG(USE_TCMALLOC)
13 return minfo.uordblks;
15 return minfo.hblkhd + minfo.arena;
17 -#elif defined(OS_FUCHSIA)
19 // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
22 diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
23 index 38811b0..be4c710 100644
24 --- a/base/trace_event/malloc_dump_provider.cc
25 +++ b/base/trace_event/malloc_dump_provider.cc
26 @@ -199,7 +199,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
28 #elif defined(OS_FUCHSIA)
29 // TODO(fuchsia): Port, see https://crbug.com/706592.
31 +#elif defined(__GLIBC__)
32 struct mallinfo info = mallinfo();
33 // In case of Android's jemalloc |arena| is 0 and the outer pages size is
34 // reported by |hblkhd|. In case of dlmalloc the total is given by
35 diff --git a/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h
36 index ac4b3e3..3736a5b 100644
37 --- a/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h
38 +++ b/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h
40 /* #undef HAVE_MALLCTL */
42 /* Define to 1 if you have the `mallinfo' function. */
43 +#if defined(__GLIBC__)
44 #define HAVE_MALLINFO 1
47 /* Define to 1 if you have the <malloc/malloc.h> header file. */
48 /* #undef HAVE_MALLOC_MALLOC_H */
49 diff --git a/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc b/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc
50 index b239046..1ffdbc5 100644
51 --- a/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc
52 +++ b/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc
53 @@ -86,7 +86,7 @@ unsigned Process::getPageSize() {
56 size_t Process::GetMallocUsage() {
57 -#if defined(HAVE_MALLINFO)
58 +#if defined(HAVE_MALLINFO) && defined(__GLIBC__)
62 diff --git a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
63 index 6a4438f..8c973f1 100644
64 --- a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
65 +++ b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
66 @@ -27,7 +27,7 @@ namespace memory {
67 const int MemoryUsage::kValueNotSet = 0;
69 bool MemoryUsage::IsSupported() {
75 @@ -35,7 +35,7 @@ bool MemoryUsage::IsSupported() {
77 MemoryUsage GetMemoryUsage() {
82 if (getrusage(RUSAGE_SELF, &res) == 0) {
83 result.max_rss_kb = res.ru_maxrss;