+ /* All blocks/fragments are equal to another block/fragment ? */
+ size_t i = 1, j = 0;
+ int nb_diff1 = 0, nb_diff2 = 0;
+
+ while(i<heaplimit){
+ if(heapinfo1[i].type == 0){
+ if(heapinfo1[i].busy_block.busy_size > 0){
+ if(heapinfo1[i].busy_block.equal_to == -1){
+ if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
+ addr_block1 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase1));
+ XBT_DEBUG("Block %zu (%p) not found (size used = %zu)", i, addr_block1, heapinfo1[i].busy_block.busy_size);
+ mmalloc_backtrace_block_display((void*)heapinfo1, i);
+ }
+ nb_diff1++;
+ }
+ }
+ }
+ if(heapinfo1[i].type > 0){
+ for(j=0; j < (size_t) (BLOCKSIZE >> heapinfo1[i].type); j++){
+ if(heapinfo1[i].busy_frag.frag_size[j] > 0){
+ if(heapinfo1[i].busy_frag.equal_to[j] == -1){
+ if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
+ addr_block1 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase1));
+ addr_frag1 = (void*) ((char *)addr_block1 + (j << heapinfo1[i].type));
+ XBT_DEBUG("Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag1, heapinfo1[i].busy_frag.frag_size[j]);
+ mmalloc_backtrace_fragment_display((void*)heapinfo1, i, j);
+ }
+ nb_diff1++;
+ }
+ }
+ }
+ }
+
+ i++;
+ }
+
+ XBT_DEBUG("Different blocks or fragments in heap1 : %d\n", nb_diff1);
+
+ i = 1;
+
+ while(i<heaplimit){
+ if(heapinfo2[i].type == 0){
+ if(heapinfo2[i].busy_block.busy_size > 0){
+ if(heapinfo2[i].busy_block.equal_to == -1){
+ if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
+ addr_block2 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase2));
+ XBT_DEBUG("Block %zu (%p) not found (size used = %zu)", i, addr_block2, heapinfo2[i].busy_block.busy_size);
+ mmalloc_backtrace_block_display((void*)heapinfo2, i);
+ }
+ nb_diff2++;
+ }
+ }
+ }
+ if(heapinfo2[i].type > 0){
+ for(j=0; j < (size_t) (BLOCKSIZE >> heapinfo2[i].type); j++){
+ if(heapinfo2[i].busy_frag.frag_size[j] > 0){
+ if(heapinfo2[i].busy_frag.equal_to[j] == -1){
+ if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
+ addr_block2 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase2));
+ addr_frag2 = (void*) ((char *)addr_block2 + (j << heapinfo2[i].type));
+ XBT_DEBUG( "Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag2, heapinfo2[i].busy_frag.frag_size[j]);
+ mmalloc_backtrace_fragment_display((void*)heapinfo2, i, j);
+ }
+ nb_diff2++;
+ }
+ }
+ }
+ }
+ i++;
+ }
+
+ XBT_DEBUG("Different blocks or fragments in heap2 : %d\n", nb_diff2);
+
+ xbt_dynar_free(&previous);
+
+ return ((nb_diff1 > 0) || (nb_diff2 > 0));
+
+}
+
+static int in_mmalloc_ignore(int block, int fragment){
+
+ unsigned int cursor = 0;
+ int start = 0;
+ int end = xbt_dynar_length(mmalloc_ignore) - 1;
+ mc_ignore_region_t region;
+
+ while(start <= end){
+ cursor = (start + end) / 2;
+ region = (mc_ignore_region_t)xbt_dynar_get_as(mmalloc_ignore, cursor, mc_ignore_region_t);
+ if(region->block == block){
+ if(region->fragment == fragment)
+ return 1;
+ if(region->fragment < fragment)
+ start = cursor + 1;
+ if(region->fragment > fragment)
+ end = cursor - 1;
+ }
+ if(region->block < block)
+ start = cursor + 1;
+ if(region->block > block)
+ end = cursor - 1;
+ }
+
+ return 0;
+}
+
+static size_t heap_comparison_ignore(void *address){
+ unsigned int cursor = 0;
+ int start = 0;
+ int end = xbt_dynar_length(mmalloc_ignore) - 1;
+ mc_ignore_region_t region;
+
+ while(start <= end){
+ cursor = (start + end) / 2;
+ region = (mc_ignore_region_t)xbt_dynar_get_as(mmalloc_ignore, cursor, mc_ignore_region_t);
+ if(region->address == address)
+ return region->size;
+ if(region->address < address)
+ start = cursor + 1;
+ if(region->address > address)
+ end = cursor - 1;
+ }
+
+ return 0;
+}
+
+
+static int compare_area(void *area1, void* area2, size_t size, xbt_dynar_t previous, int check_ignore){
+
+ size_t i = 0, pointer_align = 0, ignore1 = 0, ignore2 = 0;
+ void *address_pointed1, *address_pointed2, *addr_block_pointed1, *addr_block_pointed2, *addr_frag_pointed1, *addr_frag_pointed2;
+ size_t block_pointed1, block_pointed2, frag_pointed1, frag_pointed2;
+ int res_compare;
+ void *current_area1, *current_area2;
+
+ while(i<size){
+
+ if(check_ignore){
+
+ current_area1 = (char*)((xbt_mheap_t)s_heap)->heapbase + ((((char *)area1) + i) - (char *)heapbase1);
+ if((ignore1 = heap_comparison_ignore(current_area1)) > 0){
+ current_area2 = (char*)((xbt_mheap_t)s_heap)->heapbase + ((((char *)area2) + i) - (char *)heapbase2);
+ if((ignore2 = heap_comparison_ignore(current_area2)) == ignore1){
+ i = i + ignore2;
+ ignore_done++;
+ continue;