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

Matthew Weingarten via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 17:17:37 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)
----------------
mattweingarten wrote:

Yea I was thinking about that too. The problem is you want to keep the two files the same: 

`llvm/include/llvm/ProfileData/MemProfData.inc` and 
`compiler-rt/include/profile/MemProfData.inc`. 

If you add the stuff in the destructor, they will have to diverge because they use different allocators (one with  `malloc`, the other with `InternalAlloc`.

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


More information about the llvm-commits mailing list