From: Junyan He <junyan...@intel.com>

User can easily disable/enable the macro
CL_ALLOC_DEBUG in cl_alloc.h to find the leak
points within the cl runtime lib.

Signed-off-by: Junyan He <junyan...@intel.com>
---
 src/cl_alloc.c       | 1 +
 src/cl_platform_id.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/cl_alloc.c b/src/cl_alloc.c
index b9ac853..08b0abc 100644
--- a/src/cl_alloc.c
+++ b/src/cl_alloc.c
@@ -59,6 +59,7 @@ LOCAL void cl_alloc_debug_init(void)
   cl_alloc_log_num = 0;
 
   atexit(cl_alloc_report_unfreed);
+  atexit(cl_device_gen_cleanup);
   inited = 1;
 }
 
diff --git a/src/cl_platform_id.c b/src/cl_platform_id.c
index 2afafb2..e0f4115 100644
--- a/src/cl_platform_id.c
+++ b/src/cl_platform_id.c
@@ -19,6 +19,7 @@
 
 #include "cl_platform_id.h"
 #include "cl_internals.h"
+#include "cl_alloc.h"
 #include "cl_utils.h"
 #include "CL/cl.h"
 #include "CL/cl_ext.h"
@@ -49,6 +50,8 @@ cl_get_platform_default(void)
   if (intel_platform)
     return intel_platform;
 
+  CL_ALLOC_DEBUG_INIT();
+
   intel_platform = &intel_platform_data;
   CL_OBJECT_INIT_BASE(intel_platform, CL_OBJECT_PLATFORM_MAGIC);
   cl_intel_platform_extension_init(intel_platform);
-- 
2.7.4

_______________________________________________
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to