Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
set size_used negative for free fragment/block
[simgrid.git] / src / xbt / mmalloc / mfree.c
index 754ff30..cbdea22 100644 (file)
@@ -153,12 +153,12 @@ void mfree(struct mdesc *mdp, void *ptr)
     /* Set size used in the fragment to 0 */
     frag_nb = RESIDUAL(ptr, BLOCKSIZE) >> type;
 
     /* Set size used in the fragment to 0 */
     frag_nb = RESIDUAL(ptr, BLOCKSIZE) >> type;
 
-    if( mdp->heapinfo[block].busy_frag.frag_size[frag_nb] == 0){
+    if( mdp->heapinfo[block].busy_frag.frag_size[frag_nb] == -1){
       UNLOCK(mdp);
       THROWF(system_error, 0, "Asked to free a fragment that is already free. I'm puzzled\n");
     }
 
       UNLOCK(mdp);
       THROWF(system_error, 0, "Asked to free a fragment that is already free. I'm puzzled\n");
     }
 
-    mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = 0;
+    mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = -1;
 
     if (mdp->heapinfo[block].busy_frag.nfree ==
         (BLOCKSIZE >> type) - 1) {
 
     if (mdp->heapinfo[block].busy_frag.nfree ==
         (BLOCKSIZE >> type) - 1) {