Re: [PATCH 2/2] perf tools: Fix record failure when mixed with ARM SPE event
From: Leo Yan
Date: Sun Jul 05 2020 - 01:28:36 EST
On Fri, Jul 03, 2020 at 12:06:15PM +0800, liwei (GF) wrote:
[...]
Thanks for Mathieu's looping and agreed with his comments.
> > Last but not least do you know where the memory allocated for array arm_spe_pmus
> > is released? If you can't find it either then we have a memory leak and it
> > would be nice to have that fixed.
>
> Yes, we have a memory leak here indeed, i forgot to free it in this function.
> As 'arm_spe_pmus' is defined as static, i think the author meant to assign it only at the first call,
> but this function is only called once when we executing 'record', should i go on fixing it
> or just drop the patch 1?
I personally think patch 1 is reasonable. So for fixing memory leak,
I did a quick check, it's good to release the array "arm_spe_pmus" in
the function auxtrace_record__init(), since the array is only used in
this function.
Thanks,
Leo