blob: 5895f3143aefeee44ee63ef83e2b0b3f5dc7a6b4 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
|
From 95c68a3b5f3bfe018bc38b7e138d47d21cd7e288 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: Mon, 18 Jul 2022 22:56:44 +0200
Subject: [PATCH 1/4] mallinfo
---
src/3rdparty/chromium/base/process/process_metrics_posix.cc | 4 ++--
.../chromium/base/trace_event/malloc_dump_provider.cc | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/3rdparty/chromium/base/process/process_metrics_posix.cc b/src/3rdparty/chromium/base/process/process_metrics_posix.cc
index 9d12c427b..9030de9f6 100644
--- a/src/3rdparty/chromium/base/process/process_metrics_posix.cc
+++ b/src/3rdparty/chromium/base/process/process_metrics_posix.cc
@@ -119,14 +119,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_CHROMEOS) || defined(OS_ANDROID)
+#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
struct mallinfo minfo = mallinfo();
#if BUILDFLAG(USE_TCMALLOC)
return minfo.uordblks;
#else
return minfo.hblkhd + minfo.arena;
#endif
-#elif defined(OS_FUCHSIA)
+#else //if defined(OS_FUCHSIA) // also musl doesn't do this.
// TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
return 0;
#endif
diff --git a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
index c327f4865..2717eca5a 100644
--- a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
+++ b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
@@ -132,7 +132,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
}
#elif defined(OS_FUCHSIA)
// TODO(fuchsia): Port, see https://crbug.com/706592.
-#else
+#elif defined(__GLIBC__)
struct mallinfo info = mallinfo();
// In case of Android's jemalloc |arena| is 0 and the outer pages size is
// reported by |hblkhd|. In case of dlmalloc the total is given by
@@ -142,6 +142,8 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
// Total allocated space is given by |uordblks|.
allocated_objects_size = info.uordblks;
+#else
+ // musl libc does not support mallinfo()
#endif
MemoryAllocatorDump* outer_dump = pmd->CreateAllocatorDump("malloc");
--
2.35.1
|