[llvm] [Memprof] Fixes memory leak in MemInfoBlock histogram. (PR #96834)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 17:13:25 PDT 2024


================
@@ -633,6 +633,8 @@ Error RawMemProfReader::symbolizeAndFilterStackFrames(
   // Drop the entries where the callstack is empty.
   for (const uint64_t Id : EntriesToErase) {
     StackMap.erase(Id);
+    if(CallstackProfileData[Id].AccessHistogramSize > 0)
----------------
snehasish wrote:

This seems like a bug which could happen elsewhere too. What do you think about adding a destructor to the MemInfoBlock which releases any allocated memory if the histogram size > 0?

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


More information about the llvm-commits mailing list