[llvm] [memprof][NFC] Free symbolizer memory eagerly (PR #75119)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 10:35:22 PST 2023


https://github.com/snehasish commented:

Reseting the unique_ptr here seems fine but I think we should make the lifetime of the Symbolizer clearer and make it harder to accidentally misuse. 

Can you refactor the `symbolizeAndFilterStackFrames` function to take a `std::unique_ptr<llvm::symbolize::SymbolizableModule>`? Then we can remove the Symbolizer member in the RawMemProfReader class so that we can't deref a null member after the `symbolizeAndFilterStackFrames` function is called. This way you can even drop the explicit reset as the Symbolizer will be destructed implicitly once the function returns.

https://github.com/llvm/llvm-project/pull/75119


More information about the llvm-commits mailing list