Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
set size_used negative for free fragment/block
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 8 Oct 2012 23:53:15 +0000 (01:53 +0200)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 8 Oct 2012 23:53:36 +0000 (01:53 +0200)
src/xbt/mmalloc/mfree.c
src/xbt/mmalloc/mm_diff.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) {
index bf9fb0d..6115d9a 100644 (file)
@@ -334,7 +334,7 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
 
         current_fragment = j1;
 
 
         current_fragment = j1;
 
-        if(heapinfo1[i1].busy_frag.frag_size[j1] == 0) /* Free fragment */
+        if(heapinfo1[i1].busy_frag.frag_size[j1] == -1) /* Free fragment */
           continue;
 
         if(heapinfo1[i1].busy_frag.equal_to[j1] != NULL)
           continue;
 
         if(heapinfo1[i1].busy_frag.equal_to[j1] != NULL)