From 14a69c191a473f265fb15fe827e31bcc12b39364 Mon Sep 17 00:00:00 2001 From: Marion Guthmuller Date: Tue, 9 Oct 2012 01:53:15 +0200 Subject: [PATCH 1/1] set size_used negative for free fragment/block --- src/xbt/mmalloc/mfree.c | 4 ++-- src/xbt/mmalloc/mm_diff.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xbt/mmalloc/mfree.c b/src/xbt/mmalloc/mfree.c index 754ff3098b..cbdea22070 100644 --- a/src/xbt/mmalloc/mfree.c +++ b/src/xbt/mmalloc/mfree.c @@ -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; - 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"); } - 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) { diff --git a/src/xbt/mmalloc/mm_diff.c b/src/xbt/mmalloc/mm_diff.c index bf9fb0d73d..6115d9a1c3 100644 --- a/src/xbt/mmalloc/mm_diff.c +++ b/src/xbt/mmalloc/mm_diff.c @@ -334,7 +334,7 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac 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) -- 2.20.1