From bbe531c4acacf202889e33964156615e530f0a7e Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Fri, 8 Sep 2023 16:25:36 -0700 Subject: [PATCH] [Basic] `MaxMallocUsage` statistic should cover all zones Also for some reason passing `malloc_default_zone()` no longer works, statistics return `0` use. --- lib/Basic/Statistic.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Basic/Statistic.cpp b/lib/Basic/Statistic.cpp index 04b0bc83a4e65..2a4db8238de8b 100644 --- a/lib/Basic/Statistic.cpp +++ b/lib/Basic/Statistic.cpp @@ -530,7 +530,8 @@ void updateProcessWideFrontendCounters( // On Darwin we have a lifetime max that's maintained by malloc we can // just directly query, even if we only make one query on shutdown. malloc_statistics_t Stats; - malloc_zone_statistics(malloc_default_zone(), &Stats); + // Query all zones. + malloc_zone_statistics(/*zone=*/NULL, &Stats); C.MaxMallocUsage = (int64_t)Stats.max_size_in_use; #else // If we don't have a malloc-tracked max-usage counter, we have to rely