[LTP] [PATCH] perf_event_open: improve the memory leak detection
Li Wang
liwang@redhat.com
Fri Jul 19 04:02:58 CEST 2024
Hi Martin, Cyril,
On Thu, Jul 18, 2024 at 11:25 PM Martin Doucha <mdoucha@suse.cz> wrote:
> On 18. 07. 24 17:20, Cyril Hrubis wrote:
> >>> Maybe this can rather be if ((sample > 5) && (diff_total > 100 * 1024))
> >>>
> >>> That means that the available memory has been eaten by something and
> >>> that it happened more or less in a linear fashion when the program was
> >>> running.
> >>
> >> Imagine that some other process releases 300MB of memory while the test
> >> is running. If you change the || to &&, you'll get a false negative in
> >> that case. The sampling approach will protect against such interference.
> >>
> >> That being said, if the available memory on your test system fluctuates
> >> by 100+MB during a test run that takes <10 seconds, I'd recommend
> >> investigating what's causing such fluctuation. On the test machine I
> >> used to verify this patch, I can see <10MB of difference before and
> >> after running the test on a fixed kernel.
> >
> > So shall we remove the diff_total completely?
>
> No, diff_total is still useful because it checks for smaller leak than
> the sum of samples.
>
Thanks so much for your confirmation and test.
I pushed the patch with improvements as you suggested. Let's see how it
goes in future tests.
--
Regards,
Li Wang
More information about the ltp
mailing list