[LTP] [PATCH] aio-stress: fix memory leak
Petr Vorel
pvorel@suse.cz
Thu Feb 20 12:32:20 CET 2025
Hi Jan,
> setup_shared_mem() currently runs as part of run() function,
> and if it runs for too many iterations it can consume so much
> memory that OOM kills it.
> Move setup_shared_mem() along with the 2 checks for io_iter and
> num_threads to setup(). This way it runs only once and gets
> freed on test exit.
> As consequence setup_ious() also needs to be modified to no longer
> modify global variable 'aligned_buffer', because we don't re-initialize
> it on every iteration.
> And finally, at the end of run() function free also memory allocated
> by setup_ious().
Good catch, thanks!
Acked-by: Petr Vorel <pvorel@suse.cz>
nit: I would try to separate what can be separated (maybe free() calls?).
Kind regards,
Petr
More information about the ltp
mailing list