[PATCHSET 0/8] perf sched: Fix various memory leaks

Namhyung Kim posted 8 patches 3 months ago
tools/perf/builtin-sched.c      | 147 +++++++++++++++++++++++---------
tools/perf/tests/shell/sched.sh |  39 +++++++--
tools/perf/util/evsel.c         |  11 +++
tools/perf/util/evsel.h         |   2 +
4 files changed, 153 insertions(+), 46 deletions(-)
[PATCHSET 0/8] perf sched: Fix various memory leaks
Posted by Namhyung Kim 3 months ago
Hello,

While running the new perf sched test with ASAN, it fails due to
memory leaks.  They comes mostly from missing thread__put() but
sometimes it needs to release other data structures.

Fix those leaks and add more subcommands to the test.

Thanks,
Namhyung


Namhyung Kim (8):
  perf sched: Make sure it frees the usage string
  perf sched: Free thread->priv using priv_destructor
  perf sched: Fix memory leaks in 'perf sched map'
  perf sched: Fix thread leaks in 'perf sched timehist'
  perf sched: Fix memory leaks for evsel->priv in timehist
  perf sched: Use RC_CHK_EQUAL() to compare pointers
  perf sched: Fix memory leaks in 'perf sched latency'
  perf test: Add more test cases to sched test

 tools/perf/builtin-sched.c      | 147 +++++++++++++++++++++++---------
 tools/perf/tests/shell/sched.sh |  39 +++++++--
 tools/perf/util/evsel.c         |  11 +++
 tools/perf/util/evsel.h         |   2 +
 4 files changed, 153 insertions(+), 46 deletions(-)

-- 
2.50.0.727.gbf7dc18ff4-goog
Re: [PATCHSET 0/8] perf sched: Fix various memory leaks
Posted by Ian Rogers 3 months ago
On Wed, Jul 2, 2025 at 6:49 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> Hello,
>
> While running the new perf sched test with ASAN, it fails due to
> memory leaks.  They comes mostly from missing thread__put() but
> sometimes it needs to release other data structures.
>
> Fix those leaks and add more subcommands to the test.

Thanks Namhyung, it may be worth adding Fixes tags for the benefit of backports.

Tested-by: Ian Rogers <irogers@google.com>

Ian




> Thanks,
> Namhyung
>
>
> Namhyung Kim (8):
>   perf sched: Make sure it frees the usage string
>   perf sched: Free thread->priv using priv_destructor
>   perf sched: Fix memory leaks in 'perf sched map'
>   perf sched: Fix thread leaks in 'perf sched timehist'
>   perf sched: Fix memory leaks for evsel->priv in timehist
>   perf sched: Use RC_CHK_EQUAL() to compare pointers
>   perf sched: Fix memory leaks in 'perf sched latency'
>   perf test: Add more test cases to sched test
>
>  tools/perf/builtin-sched.c      | 147 +++++++++++++++++++++++---------
>  tools/perf/tests/shell/sched.sh |  39 +++++++--
>  tools/perf/util/evsel.c         |  11 +++
>  tools/perf/util/evsel.h         |   2 +
>  4 files changed, 153 insertions(+), 46 deletions(-)
>
> --
> 2.50.0.727.gbf7dc18ff4-goog
>
Re: [PATCHSET 0/8] perf sched: Fix various memory leaks
Posted by Namhyung Kim 3 months ago
On Wed, Jul 02, 2025 at 08:45:18PM -0700, Ian Rogers wrote:
> On Wed, Jul 2, 2025 at 6:49 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > Hello,
> >
> > While running the new perf sched test with ASAN, it fails due to
> > memory leaks.  They comes mostly from missing thread__put() but
> > sometimes it needs to release other data structures.
> >
> > Fix those leaks and add more subcommands to the test.
> 
> Thanks Namhyung, it may be worth adding Fixes tags for the benefit of backports.

I was too lazy to find the commits. ;-p

> 
> Tested-by: Ian Rogers <irogers@google.com>

Thanks for your review and test!
Namhyung

Re: [PATCHSET 0/8] perf sched: Fix various memory leaks
Posted by Namhyung Kim 3 months ago
On Wed, 02 Jul 2025 18:49:34 -0700, Namhyung Kim wrote:
> While running the new perf sched test with ASAN, it fails due to
> memory leaks.  They comes mostly from missing thread__put() but
> sometimes it needs to release other data structures.
> 
> Fix those leaks and add more subcommands to the test.
> 
> Thanks,
> Namhyung
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung