aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/no-mallinfo.patch
blob: e95e94814e78747b931b4d051e94dc73f2431ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--- content/child/content_child_helpers.cc.orig
+++ content/child/content_child_helpers.cc
@@ -24,7 +24,7 @@ namespace content {
 // though, this provides only a partial and misleading value.
 // Unfortunately some telemetry benchmark rely on it and these need to
 // be refactored before getting rid of this. See crbug.com/581365 .
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_LINUX) && defined(__GLIBC__) || defined(OS_ANDROID)
 size_t GetMemoryUsageKB() {
   struct mallinfo minfo = mallinfo();
   uint64_t mem_usage =
--- base/trace_event/malloc_dump_provider.cc.orig
+++ base/trace_event/malloc_dump_provider.cc
@@ -243,7 +243,7 @@
   allocated_objects_count = main_heap_info.block_count;
 #elif defined(OS_FUCHSIA)
 // TODO(fuchsia): Port, see https://crbug.com/706592.
-#else
+#elif defined(__GLIBC__)
   struct mallinfo info = mallinfo();
   DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
 
diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc
index 0eb5c1f..8af7799 100644
--- base/process/process_metrics_posix.cc
+++ base/process/process_metrics_posix.cc
@@ -94,14 +94,14 @@ size_t ProcessMetrics::GetMallocUsage() {
   malloc_statistics_t stats = {0};
   malloc_zone_statistics(nullptr, &stats);
   return stats.size_in_use;
-#elif defined(OS_LINUX) || defined(OS_ANDROID)
+#elif defined(__GLIBC__) || defined(OS_ANDROID)
   struct mallinfo minfo = mallinfo();
 #if defined(USE_TCMALLOC)
   return minfo.uordblks;
 #else
   return minfo.hblkhd + minfo.arena;
 #endif
-#elif defined(OS_FUCHSIA)
+#else
   // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
   return 0;
 #endif