summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2016-07-02 15:34:55 +0200
committerCedric Nugteren <web@cedricnugteren.nl>2016-07-02 15:34:55 +0200
commit7cf2f8c26882aee4cd3e95fe22967f04318b6bf7 (patch)
treed6f30bdf0c71864b9c89ecc24dd8cd1ef7e9a3b1 /samples
parentb330ab086640382157688ea6b9633b5f0a22dac3 (diff)
Fixed some memory leaks related to events not properly cleaned-up
Diffstat (limited to 'samples')
-rw-r--r--samples/cache.c1
-rw-r--r--samples/dgemv.c1
-rw-r--r--samples/haxpy.c1
-rw-r--r--samples/sasum.c1
-rw-r--r--samples/sgemm.c1
-rw-r--r--samples/sgemm.cpp1
6 files changed, 6 insertions, 0 deletions
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<double,std::milli>(elapsed_time).count();