Browse Source

fix build

Samuel Thibault 8 years ago
parent
commit
f3a4fb9302
1 changed files with 6 additions and 2 deletions
  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
 					/* mc is still associated with the old
 					 * handle, now replace the previous data
 					 * 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;
+					}
 				}
 				}
 			}
 			}
 		}
 		}