[LTP] [PATCH] perf_event_open: improve the memory leak detection

Martin Doucha mdoucha@suse.cz
Thu Jul 18 17:25:39 CEST 2024


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.

-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic



More information about the ltp mailing list