瀏覽代碼

fix memory leak

Samuel Thibault 9 年之前
父節點
當前提交
6920c2293e
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 2 1
      doc/doxygen/chapters/api/insert_task.doxy
  2. 1 0
      src/util/starpu_task_insert_utils.c

+ 2 - 1
doc/doxygen/chapters/api/insert_task.doxy

@@ -56,7 +56,8 @@ constant
 this macro is used when calling starpu_task_insert(), and must
 be followed by a memory buffer containing the arguments to be given to
 the task, and by the size of the arguments. The memory buffer should
-be the result of a previous call to starpu_codelet_pack_args()
+be the result of a previous call to starpu_codelet_pack_args(), and will be
+freed (i.e. starpu_task::cl_arg_free will be set to 1)
 
 \def STARPU_CALLBACK
 \ingroup API_Insert_Task

+ 1 - 0
src/util/starpu_task_insert_utils.c

@@ -324,6 +324,7 @@ int _starpu_task_insert_create(struct starpu_codelet *cl, struct starpu_task **t
 		{
 			(*task)->cl_arg = va_arg(varg_list, void *);
 			(*task)->cl_arg_size = va_arg(varg_list, size_t);
+			(*task)->cl_arg_free = 1;
 		}
 		else if (arg_type==STARPU_CALLBACK)
 		{