From e4674b85e94a2f158b30417313bfbfb643b3eab2 Mon Sep 17 00:00:00 2001 From: Shanzhi Chen Date: Mon, 9 Feb 2026 11:27:55 +0800 Subject: [PATCH] [BOLT][NFC] Stop populating unnecessary samples into MemSamples (#179472) Currently, many unnecessary samples are populated into MemSamples, including zero-initialized samples and samples in which the PC address is not contained in any BinaryFunction. But these samples are totally skipped during processing and the whole MemSamples vector is cleared immediately after processing. So, we could just stop populating these samples into MemSamples, which would reduce maximum resident set size when processing a large perf.data. --- bolt/lib/Profile/DataAggregator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp index cce08658fefb..a616d9db9db0 100644 --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -1729,10 +1729,10 @@ std::error_code DataAggregator::parseMemEvents() { if (std::error_code EC = Sample.getError()) return EC; - if (BinaryFunction *BF = getBinaryFunctionContainingAddress(Sample->PC)) + if (BinaryFunction *BF = getBinaryFunctionContainingAddress(Sample->PC)) { BF->setHasProfileAvailable(); - - MemSamples.emplace_back(std::move(Sample.get())); + MemSamples.emplace_back(std::move(Sample.get())); + } } return std::error_code();