浏览代码

fix build

Samuel Thibault 8 年之前
父节点
当前提交
f3a4fb9302
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/datawizard/memalloc.c

+ 6 - 2
src/datawizard/memalloc.c

@@ -647,8 +647,12 @@ static unsigned try_to_reuse_mem_chunk(struct _starpu_mem_chunk *mc, unsigned no
 					/* mc is still associated with the old
 					 * handle, now replace the previous data
 					 */
-					reuse_mem_chunk(node, replicate, mc, is_already_in_mc_list);
-					success = 1;
+					if (old_data->per_node[node].refcnt == 0)
+					{
+						/* And still nobody on it, now the actual buffer may be reused */
+						reuse_mem_chunk(node, replicate, mc, is_already_in_mc_list);
+						success = 1;
+					}
 				}
 			}
 		}