Skip to content

Commit

Permalink
workgroups: fix program/kernel object leak
Browse files Browse the repository at this point in the history
`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 <sven.vanhaastregt@arm.com>
  • Loading branch information
svenvh committed Jun 21, 2023
1 parent 50f9f06 commit cfb0ae0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand All @@ -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,
Expand Down

0 comments on commit cfb0ae0

Please sign in to comment.