From 7cf2f8c26882aee4cd3e95fe22967f04318b6bf7 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sat, 2 Jul 2016 15:34:55 +0200 Subject: Fixed some memory leaks related to events not properly cleaned-up --- samples/cache.c | 1 + samples/dgemv.c | 1 + samples/haxpy.c | 1 + samples/sasum.c | 1 + samples/sgemm.c | 1 + samples/sgemm.cpp | 1 + 6 files changed, 6 insertions(+) (limited to 'samples') diff --git a/samples/cache.c b/samples/cache.c index 7f876be1..a592824d 100644 --- a/samples/cache.c +++ b/samples/cache.c @@ -113,6 +113,7 @@ void run_example_routine(const cl_device_id device) { // Wait for completion clWaitForEvents(1, &event); + clReleaseEvent(event); // Retrieves the execution time clock_t diff = clock() - start; diff --git a/samples/dgemv.c b/samples/dgemv.c index 6ea0deb0..c22c9f37 100644 --- a/samples/dgemv.c +++ b/samples/dgemv.c @@ -85,6 +85,7 @@ int main(void) { // Wait for completion clWaitForEvents(1, &event); + clReleaseEvent(event); // Example completed. See "clblast_c.h" for status codes (0 -> success). printf("Completed DGEMV with status %d\n", status); diff --git a/samples/haxpy.c b/samples/haxpy.c index 3c7bb33a..d5b98e12 100644 --- a/samples/haxpy.c +++ b/samples/haxpy.c @@ -78,6 +78,7 @@ int main(void) { // Wait for completion clWaitForEvents(1, &event); + clReleaseEvent(event); // Copies the result back to the host clEnqueueReadBuffer(queue, device_b, CL_TRUE, 0, n*sizeof(cl_half), host_b, 0, NULL, NULL); diff --git a/samples/sasum.c b/samples/sasum.c index 3fdbb0eb..1518cc13 100644 --- a/samples/sasum.c +++ b/samples/sasum.c @@ -74,6 +74,7 @@ int main(void) { // Wait for completion clWaitForEvents(1, &event); + clReleaseEvent(event); // Copies the result back to the host clEnqueueReadBuffer(queue, device_output, CL_TRUE, 0, 1*sizeof(float), host_output, 0, NULL, NULL); diff --git a/samples/sgemm.c b/samples/sgemm.c index 79f30c83..b4827777 100644 --- a/samples/sgemm.c +++ b/samples/sgemm.c @@ -88,6 +88,7 @@ int main(void) { // Wait for completion clWaitForEvents(1, &event); + clReleaseEvent(event); // Example completed. See "clblast_c.h" for status codes (0 -> success). printf("Completed SGEMM with status %d\n", status); diff --git a/samples/sgemm.cpp b/samples/sgemm.cpp index 5fe7490a..a4b89968 100644 --- a/samples/sgemm.cpp +++ b/samples/sgemm.cpp @@ -96,6 +96,7 @@ int main() { // Record the execution time clWaitForEvents(1, &event); + clReleaseEvent(event); auto elapsed_time = std::chrono::steady_clock::now() - start_time; auto time_ms = std::chrono::duration(elapsed_time).count(); -- cgit v1.2.3