[PATCH] D102039: [profile] WIP Add binary id into profiles
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 16 16:12:11 PDT 2021
phosek added inline comments.
================
Comment at: llvm/lib/ProfileData/InstrProfReader.cpp:534
+const BinaryIdTy *RawInstrProfReader<IntPtrT>::getBinaryIds() {
+ return new BinaryIdTy(BinaryIdsSize, BinaryIdsStart);
+}
----------------
gulfem wrote:
> phosek wrote:
> > Where is this deallocated? It seems like this memory gets leaked. `BinaryIdTy` is just a plain struct with just two 8 byte fields (on a 64-bit machine), can we avoid allocating it on the heap and return/pass it by value to simplify lifetime management?
> I used `unique_ptr`, so memory will be released after BinaryIdTy goes out of scope.
I'd still prefer passing these by value, heap allocation in this case seems unnecessary and is going to be less efficient.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102039/new/
https://reviews.llvm.org/D102039
More information about the llvm-commits
mailing list