Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/acl_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,11 +1014,15 @@ static void l_forcibly_release_allocations(cl_context context) {
}

if (context->invocation_wrapper) {
unsigned i;
for (i = 0; i < context->num_invocation_wrappers_allocated; i++) {
if (context->invocation_wrapper[i]->image->arg_value)
acl_delete_arr(context->invocation_wrapper[i]->image->arg_value);
acl_free(context->invocation_wrapper[i]);
for (unsigned int i = 0; i < context->num_invocation_wrappers_allocated;
i++) {
auto *const wrapper = context->invocation_wrapper[i];
if (wrapper->image->arg_value) {
acl_delete_arr(wrapper->image->arg_value);
}
// invoke non-default destructors of non-POD types, e.g., std::vector
wrapper->~acl_kernel_invocation_wrapper_t();
acl_free(wrapper);
}
acl_free(context->invocation_wrapper);
context->invocation_wrapper = 0;
Expand Down Expand Up @@ -1208,6 +1212,8 @@ l_init_kernel_invocation_wrapper(acl_kernel_invocation_wrapper_t *wrapper,
acl_assert_locked();

if (wrapper) {
// invoke non-default constructors of non-POD types, e.g., std::vector
new (wrapper) acl_kernel_invocation_wrapper_t{};
wrapper->id = i;
wrapper->image = &(wrapper->image_storage);
wrapper->image->arg_value = nullptr;
Expand Down