[PATCH v3 0/8] perf timechart: Fix memory leaks

From: Namhyung Kim

Date: Wed Jun 24 2026 - 16:59:08 EST


Hello,

This patchset fixes memory leaks in the perf timechart code.
I've extended and verified the timechart test with ASAN.

I'm sending it with my previous work on backtrace optimization.

v3)
* combine small optimization series

v2)
* use zfree() and explicit clear for potential misuse (Arnaldo)
* fix a wrong condition in the draw_wakeups() (Sashiko)
* move misplaced hunk in the second commit to the first

Thanks,
Namhyung


Namhyung Kim (8):
perf timechart: Don't pass @event to cat_backtrace()
perf timechart: Generate backtrace only if needed
perf timechart: Remove unused backtrace in trace_handler
perf timechart: Remove unnecessary copy of backtrace
perf timechart: Release event samples at the end
perf timechart: Fix memory leaks during record
perf timechart: Fix memory leaks in draw_wakeups()
perf test: Update perf timechart test

tools/perf/builtin-timechart.c | 212 +++++++++++++++++++---------
tools/perf/tests/shell/timechart.sh | 24 ++--
2 files changed, 158 insertions(+), 78 deletions(-)

--
2.55.0.rc0.799.gd6f94ed593-goog