summaryrefslogtreecommitdiffstats
path: root/xpcom/base/nsMemoryReporterManager.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /xpcom/base/nsMemoryReporterManager.cpp
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xpcom/base/nsMemoryReporterManager.cpp')
-rw-r--r--xpcom/base/nsMemoryReporterManager.cpp63
1 files changed, 45 insertions, 18 deletions
diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp
index aaf1baeea2..a3a2a247f6 100644
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -1247,7 +1247,7 @@ NS_IMPL_ISUPPORTS(PageFaultsHardReporter, nsIMemoryReporter)
#ifdef HAVE_JEMALLOC_STATS
static size_t HeapOverhead(const jemalloc_stats_t& aStats) {
- return aStats.waste + aStats.bookkeeping + aStats.page_cache +
+ return aStats.waste + aStats.bookkeeping + aStats.pages_dirty +
aStats.bin_unused;
}
@@ -1278,7 +1278,7 @@ class JemallocHeapReporter final : public nsIMemoryReporter {
// clang-format off
MOZ_COLLECT_REPORT(
- "heap-committed/allocated", KIND_OTHER, UNITS_BYTES, stats.allocated,
+ "heap/committed/allocated", KIND_OTHER, UNITS_BYTES, stats.allocated,
"Memory mapped by the heap allocator that is currently allocated to the "
"application. This may exceed the amount of memory requested by the "
"application because the allocator regularly rounds up request sizes. (The "
@@ -1286,14 +1286,14 @@ class JemallocHeapReporter final : public nsIMemoryReporter {
MOZ_COLLECT_REPORT(
"heap-allocated", KIND_OTHER, UNITS_BYTES, stats.allocated,
-"The same as 'heap-committed/allocated'.");
+"The same as 'heap/committed/allocated'.");
- // We mark this and the other heap-overhead reporters as KIND_NONHEAP
+ // We mark this and the other heap/committed/overhead reporters as KIND_NONHEAP
// because KIND_HEAP memory means "counted in heap-allocated", which
// this is not.
for (auto& bin : bin_stats) {
MOZ_ASSERT(bin.size);
- nsPrintfCString path("explicit/heap-overhead/bin-unused/bin-%zu",
+ nsPrintfCString path("heap/committed/bin-unused/bin-%zu",
bin.size);
aHandleReport->Callback(EmptyCString(), path, KIND_NONHEAP, UNITS_BYTES,
bin.bytes_unused,
@@ -1304,36 +1304,63 @@ class JemallocHeapReporter final : public nsIMemoryReporter {
if (stats.waste > 0) {
MOZ_COLLECT_REPORT(
- "explicit/heap-overhead/waste", KIND_NONHEAP, UNITS_BYTES,
+ "heap/committed/waste", KIND_NONHEAP, UNITS_BYTES,
stats.waste,
"Committed bytes which do not correspond to an active allocation and which the "
"allocator is not intentionally keeping alive (i.e., not "
-"'explicit/heap-overhead/{bookkeeping,page-cache,bin-unused}').");
+"'heap/{bookkeeping,unused-pages,bin-unused}').");
}
MOZ_COLLECT_REPORT(
- "explicit/heap-overhead/bookkeeping", KIND_NONHEAP, UNITS_BYTES,
+ "heap/committed/bookkeeping", KIND_NONHEAP, UNITS_BYTES,
stats.bookkeeping,
"Committed bytes which the heap allocator uses for internal data structures.");
MOZ_COLLECT_REPORT(
- "explicit/heap-overhead/page-cache", KIND_NONHEAP, UNITS_BYTES,
- stats.page_cache,
+ "heap/committed/unused-pages/dirty", KIND_NONHEAP, UNITS_BYTES,
+ stats.pages_dirty,
"Memory which the allocator could return to the operating system, but hasn't. "
"The allocator keeps this memory around as an optimization, so it doesn't "
"have to ask the OS the next time it needs to fulfill a request. This value "
"is typically not larger than a few megabytes.");
MOZ_COLLECT_REPORT(
- "heap-committed/overhead", KIND_OTHER, UNITS_BYTES,
- HeapOverhead(stats),
-"The sum of 'explicit/heap-overhead/*'.");
+ "heap/decommitted/unused-pages/fresh", KIND_OTHER, UNITS_BYTES, stats.pages_fresh,
+"Amount of memory currently mapped but has never been used.");
+ // A duplicate entry in the decommitted part of the tree.
+ MOZ_COLLECT_REPORT(
+ "decommitted/heap/unused-pages/fresh", KIND_OTHER, UNITS_BYTES, stats.pages_fresh,
+"Amount of memory currently mapped but has never been used.");
+// On MacOS madvised memory is still counted in the resident set until the OS
+// actually decommits it.
+#ifdef XP_MACOSX
+#define MADVISED_GROUP "committed"
+#else
+#define MADVISED_GROUP "decommitted"
+#endif
+ MOZ_COLLECT_REPORT(
+ "heap/" MADVISED_GROUP "/unused-pages/madvised", KIND_OTHER, UNITS_BYTES,
+ stats.pages_madvised,
+"Amount of memory currently mapped, not used and that the OS should remove "
+"from the application's resident set.");
+ // A duplicate entry in the decommitted part of the tree.
MOZ_COLLECT_REPORT(
- "heap-mapped", KIND_OTHER, UNITS_BYTES, stats.mapped,
-"Amount of memory currently mapped. Includes memory that is uncommitted, i.e. "
-"neither in physical memory nor paged to disk.");
+ "decommitted/heap/unused-pages/madvised", KIND_OTHER, UNITS_BYTES, stats.pages_madvised,
+"Amount of memory currently mapped, not used and that the OS should remove "
+"from the application's resident set.");
+ {
+ size_t decommitted = stats.mapped - stats.allocated - stats.waste - stats.pages_dirty - stats.pages_fresh - stats.bookkeeping - stats.bin_unused;
+ MOZ_COLLECT_REPORT(
+ "heap/decommitted/unmapped", KIND_OTHER, UNITS_BYTES, decommitted,
+ "Amount of memory currently mapped but not committed, "
+ "neither in physical memory nor paged to disk.");
+ MOZ_COLLECT_REPORT(
+ "decommitted/heap/decommitted", KIND_OTHER, UNITS_BYTES, decommitted,
+ "Amount of memory currently mapped but not committed, "
+ "neither in physical memory nor paged to disk.");
+ }
MOZ_COLLECT_REPORT(
"heap-chunksize", KIND_OTHER, UNITS_BYTES, stats.chunksize,
"Size of chunks.");
@@ -1343,11 +1370,11 @@ class JemallocHeapReporter final : public nsIMemoryReporter {
mozilla::phc::PHCMemoryUsage(usage);
MOZ_COLLECT_REPORT(
- "explicit/heap-overhead/phc/metadata", KIND_NONHEAP, UNITS_BYTES,
+ "explicit/phc/metadata", KIND_NONHEAP, UNITS_BYTES,
usage.mMetadataBytes,
"Memory used by PHC to store stacks and other metadata for each allocation");
MOZ_COLLECT_REPORT(
- "explicit/heap-overhead/phc/fragmentation", KIND_NONHEAP, UNITS_BYTES,
+ "explicit/phc/fragmentation", KIND_NONHEAP, UNITS_BYTES,
usage.mFragmentationBytes,
"The amount of memory lost due to rounding up allocations to the next page "
"size. "