Skip to content

Commit ca4e5a8

Browse files
[Memprof] Fixes memory leak in MemInfoBlock histogram. (#96834)
MemInfoBlocks (MIB) with empty callstacks are erased prematurely from the CallStackProfileData. This patch frees allocated histogram buffers when the MIB is associated with an empty callstack.
1 parent dae061f commit ca4e5a8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/ProfileData/MemProfReader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ Error RawMemProfReader::symbolizeAndFilterStackFrames(
633633
// Drop the entries where the callstack is empty.
634634
for (const uint64_t Id : EntriesToErase) {
635635
StackMap.erase(Id);
636+
if(CallstackProfileData[Id].AccessHistogramSize > 0)
637+
free((void*) CallstackProfileData[Id].AccessHistogram);
636638
CallstackProfileData.erase(Id);
637639
}
638640

0 commit comments

Comments
 (0)