From cfb0ae0a0c3326e6e6e3e9f09139d63e701cecf6 Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Wed, 21 Jun 2023 18:21:27 +0100 Subject: [PATCH] workgroups: fix program/kernel object leak `create_single_kernel_helper` is called in a loop, overwriting the objects contained in the wrapper classes. The wrapper class is not aware of this, as the overwriting happens through its `operator&`. Move the wrapper objects into the loop, so that the contained objects get released as soon as the program and kernel objects are no longer needed. Signed-off-by: Sven van Haastregt --- .../workgroups/test_wg_suggested_local_work_size.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_conformance/workgroups/test_wg_suggested_local_work_size.cpp b/test_conformance/workgroups/test_wg_suggested_local_work_size.cpp index 648e68ce1d..2e7c114e01 100644 --- a/test_conformance/workgroups/test_wg_suggested_local_work_size.cpp +++ b/test_conformance/workgroups/test_wg_suggested_local_work_size.cpp @@ -221,8 +221,6 @@ int do_test_work_group_suggested_local_size( bool (*skip_cond)(size_t), size_t start, size_t end, size_t incr, cl_long max_local_mem_size, size_t global_work_offset[], num_dims dim) { - clProgramWrapper scan_program; - clKernelWrapper scan_kernel; int err; size_t test_values[] = { 1, 1, 1 }; std::string kernel_names[6] = { @@ -244,6 +242,8 @@ int do_test_work_group_suggested_local_size( for (int kernel_num = 0; kernel_num < 6; kernel_num++) { if (max_local_mem_size < local_mem_size[kernel_num]) continue; + clProgramWrapper scan_program; + clKernelWrapper scan_kernel; // Create the kernel err = create_single_kernel_helper( context, &scan_program, &scan_kernel, 1,