perf bench: Fix memory leaks.
PATCH 1/1 perf bench: Fix memory leaks.
ASan reports memory leaks while running:
$ perf bench sched all
Signed-off-by Sohaib Mohamed <[email protected]>
--- tools/perf/bench/sched-messaging.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/perf/bench/sched-messaging.c +4 -0
@@ -223,6 +223,8 @@ static unsigned int group(pthread_t *pth, snd_ctx->out_fds[i] = fds[1 ];if (!thread_mode)close (fds[0 ]); + +free (ctx); }/* Now we have all the fds, fork the senders */
@@ -239,6 +241,8 @@ static unsigned int group(pthread_t *pth,for (i =0 ; i < num_fds; i++)close (snd_ctx->out_fds[i]); +free (snd_ctx); +/* Return number of children to reap */ return num_fds *2 ; }
--
2.25.1
Quoted 6 lines · Sohaib Mohamed
ASan reports memory leaks while running:
$ perf bench sched allSigned-off-by Sohaib Mohamed <[email protected]>
Acked-by Ian Rogers <[email protected]>
I think you can add:
Fixes e27454cc6352c ("perf bench: Add sched-messaging.c: Benchmark
for scheduler and IPC mechanisms based on hackbench")
This will then get the fix backported to older stable perf commands.
Thanks,
Ian
Quoted 29 lines
--- tools/perf/bench/sched-messaging.c | 4 ++++ 1 file changed, 4 insertions(+)tools/perf/bench/sched-messaging.c +4
-1@@ -223,6 +223,8 @@ static unsigned int group(pthread_t *pth, snd_ctx->out_fds[i] = fds[1 ];if (!thread_mode)close (fds[0 ]); + +free (ctx); }/* Now we have all the fds, fork the senders */ @@ -239,6 +241,8 @@ static unsigned int group(pthread_t *pth,for (i =0 ; i < num_fds; i++)close (snd_ctx->out_fds[i]); +free (snd_ctx); +/* Return number of children to reap */ return num_fds *2 ; } --2.25.1
Quoted 8 lines · Ian Rogers
Quoted 6 lines · Sohaib Mohamed
ASan reports memory leaks while running:
$ perf bench sched allSigned-off-by Sohaib Mohamed <[email protected]>
Quoted 7 lines
Acked-by Ian Rogers <[email protected]>I think you can add:
Fixes e27454cc6352c ("perf bench: Add sched-messaging.c: Benchmarkfor scheduler and IPC mechanisms based on hackbench")
This will then get the fix backported to older stable perf commands.
I just added these two lines to version 2:
https://lore.kernel.org/linux-perf-users/[email protected]/
Thanks,
Sohaib
Quoted 33 lines
Thanks,
IanQuoted 29 lines
--- tools/perf/bench/sched-messaging.c | 4 ++++ 1 file changed, 4 insertions(+)tools/perf/bench/sched-messaging.c +4
-1@@ -223,6 +223,8 @@ static unsigned int group(pthread_t *pth, snd_ctx->out_fds[i] = fds[1 ];if (!thread_mode)close (fds[0 ]); + +free (ctx); }/* Now we have all the fds, fork the senders */ @@ -239,6 +241,8 @@ static unsigned int group(pthread_t *pth,for (i =0 ; i < num_fds; i++)close (snd_ctx->out_fds[i]); +free (snd_ctx); +/* Return number of children to reap */ return num_fds *2 ; } --2.25.1