[PATCH] D118677: [llvm-profgen] Clean up unnecessary memory reservations between phases.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 1 12:11:27 PST 2022
hoy updated this revision to Diff 405041.
hoy edited the summary of this revision.
hoy added a comment.
Updating D118677 <https://reviews.llvm.org/D118677>: [llvm-profgen] Clean up unnecessary memory reservations between phases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118677/new/
https://reviews.llvm.org/D118677
Files:
llvm/tools/llvm-profgen/PerfReader.cpp
llvm/tools/llvm-profgen/llvm-profgen.cpp
Index: llvm/tools/llvm-profgen/llvm-profgen.cpp
===================================================================
--- llvm/tools/llvm-profgen/llvm-profgen.cpp
+++ llvm/tools/llvm-profgen/llvm-profgen.cpp
@@ -158,6 +158,9 @@
ProfileGeneratorBase::create(Binary.get(), Reader->getSampleCounters(),
Reader->profileIsCSFlat());
Generator->generateProfile();
+ // The Reader object, espcially its SampleCounters field, is not needed at
+ // this point, so releasing it to reduce peak memory usage.
+ Reader.release();
Generator->write();
return EXIT_SUCCESS;
Index: llvm/tools/llvm-profgen/PerfReader.cpp
===================================================================
--- llvm/tools/llvm-profgen/PerfReader.cpp
+++ llvm/tools/llvm-profgen/PerfReader.cpp
@@ -1212,6 +1212,7 @@
warnTruncatedStack();
warnInvalidRange();
generateUnsymbolizedProfile();
+ AggregatedSamples.clear();
if (SkipSymbolization)
writeUnsymbolizedProfile(OutputFilename);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118677.405041.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220201/57f1e50c/attachment.bin>
More information about the llvm-commits
mailing list