Merge pull request #1007 from rbberger/fix_memleak_in_gpu_package

Fixes a memory leak when using OpenCL
This commit is contained in:
Steve Plimpton 2018-07-20 14:27:16 -06:00 committed by GitHub
commit 2732b8b647
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -49,8 +49,6 @@ class UCL_Timer {
inline void clear() {
if (_initialized) {
CL_DESTRUCT_CALL(clReleaseCommandQueue(_cq));
clReleaseEvent(start_event);
clReleaseEvent(stop_event);
_initialized=false;
_total_time=0.0;
}
@ -107,6 +105,8 @@ class UCL_Timer {
CL_SAFE_CALL(clGetEventProfilingInfo(start_event,
CL_PROFILING_COMMAND_END,
sizeof(cl_ulong), &tstart, NULL));
clReleaseEvent(start_event);
clReleaseEvent(stop_event);
return (tend-tstart)*t_factor;
}