[LTP] [PATCH] aio-stress: fix memory leak
Li Wang
liwan@redhat.com
Thu Feb 20 03:53:19 CET 2025
On Tue, Feb 18, 2025 at 9:55 PM Jan Stancek <jstancek@redhat.com> wrote:
> 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().
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
>
Good catch.
Reviewed-by: Li Wang <liwang@redhat.com>
More information about the ltp
mailing list