X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/44677c04b1b35803a89b68882fd3ebaa4a4a3d05..453d43c197818b5469f79845e522f5451c811791:/src/xbt/mmalloc/mm_diff.c diff --git a/src/xbt/mmalloc/mm_diff.c b/src/xbt/mmalloc/mm_diff.c index 1abac24e3f..39cd21cb80 100644 --- a/src/xbt/mmalloc/mm_diff.c +++ b/src/xbt/mmalloc/mm_diff.c @@ -1,6 +1,6 @@ /* mm_diff - Memory snapshooting and comparison */ -/* Copyright (c) 2008-2013. The SimGrid Team. +/* Copyright (c) 2008-2014. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -316,7 +316,7 @@ int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t i1, heaplimit = ((struct mdesc *)heap1)->heaplimit; - s_heap = (char *)mmalloc_get_current_heap() - STD_HEAP_SIZE - getpagesize(); + s_heap = (char *)mmalloc_get_current_heap() - STD_HEAP_SIZE - xbt_pagesize; heapbase1 = (char *)heap1 + BLOCKSIZE; heapbase2 = (char *)heap2 + BLOCKSIZE; @@ -331,31 +331,25 @@ int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t i1, to_ignore2 = i2; equals_to1 = malloc(heaplimit * sizeof(heap_area_t *)); - for(i=0; i<=heaplimit; i++){ - equals_to1[i] = malloc(MAX_FRAGMENT_PER_BLOCK * sizeof(heap_area_t)); - for(j=0; jname, "s_smx_context")) + if(type_size != heapinfo1[block1].busy_block.busy_size && type_size != heapinfo2[block2].busy_block.busy_size && !strcmp(type->name, "s_smx_context")){ + if(match_pairs){ + match_equals(previous); + xbt_dynar_free(&previous); + } return -1; + } } if(heapinfo1[block1].busy_block.size != heapinfo2[block2].busy_block.size){ @@ -1102,8 +1101,8 @@ int compare_heap_area(void *area1, void* area2, xbt_dynar_t previous, xbt_dict_t size = heapinfo1[block1].busy_block.busy_size; if(type_id != NULL){ - free(types1[block1][0]); - free(types2[block2][0]); + xbt_free(types1[block1][0]); + xbt_free(types2[block2][0]); types1[block1][0] = strdup(type_id); types2[block2][0] = strdup(type_id); } @@ -1134,13 +1133,23 @@ int compare_heap_area(void *area1, void* area2, xbt_dynar_t previous, xbt_dict_t addr_frag2 = (void*) ((char *)addr_block2 + (frag2 << heapinfo2[block2].type)); real_addr_frag1 = (void*) ((char *)real_addr_block1 + (frag1 << ((xbt_mheap_t)s_heap)->heapinfo[block1].type)); - real_addr_frag2 = (void*) ((char *)real_addr_block2 + (frag2 << ((xbt_mheap_t)s_heap)->heapinfo[block1].type)); + real_addr_frag2 = (void*) ((char *)real_addr_block2 + (frag2 << ((xbt_mheap_t)s_heap)->heapinfo[block2].type)); if(type_size != -1){ - if(heapinfo1[block1].busy_frag.frag_size[frag1] == -1 || heapinfo2[block2].busy_frag.frag_size[frag2] == -1) + if(heapinfo1[block1].busy_frag.frag_size[frag1] == -1 || heapinfo2[block2].busy_frag.frag_size[frag2] == -1){ + if(match_pairs){ + match_equals(previous); + xbt_dynar_free(&previous); + } return -1; - if(type_size != heapinfo1[block1].busy_frag.frag_size[frag1] || type_size != heapinfo2[block2].busy_frag.frag_size[frag2]) + } + if(type_size != heapinfo1[block1].busy_frag.frag_size[frag1] || type_size != heapinfo2[block2].busy_frag.frag_size[frag2]){ + if(match_pairs){ + match_equals(previous); + xbt_dynar_free(&previous); + } return -1; + } } if(equals_to1[block1][frag1] != NULL && equals_to2[block2][frag2] != NULL){ @@ -1155,6 +1164,10 @@ int compare_heap_area(void *area1, void* area2, xbt_dynar_t previous, xbt_dict_t if(heapinfo1[block1].busy_frag.frag_size[frag1] != heapinfo2[block2].busy_frag.frag_size[frag2]){ if(type_size == -1){ + if(match_pairs){ + match_equals(previous); + xbt_dynar_free(&previous); + } return -1; }else{ if(match_pairs){ @@ -1167,8 +1180,8 @@ int compare_heap_area(void *area1, void* area2, xbt_dynar_t previous, xbt_dict_t size = heapinfo1[block1].busy_frag.frag_size[frag1]; if(type_id != NULL){ - free(types1[block1][frag1]); - free(types2[block2][frag2]); + xbt_free(types1[block1][frag1]); + xbt_free(types2[block2][frag2]); types1[block1][frag1] = strdup(type_id); types2[block2][frag2] = strdup(type_id); } @@ -1186,6 +1199,10 @@ int compare_heap_area(void *area1, void* area2, xbt_dynar_t previous, xbt_dict_t new_type_id1 = get_offset_type(types2[block2][frag2], offset1, all_types, other_types, size, &switch_type); new_type_id2 = get_offset_type(types2[block2][frag2], offset2, all_types, other_types, size, &switch_type); }else{ + if(match_pairs){ + match_equals(previous); + xbt_dynar_free(&previous); + } return -1; } @@ -1210,6 +1227,10 @@ int compare_heap_area(void *area1, void* area2, xbt_dynar_t previous, xbt_dict_t new_size2 = type->size; } }else{ + if(match_pairs){ + match_equals(previous); + xbt_dynar_free(&previous); + } return -1; } } @@ -1351,7 +1372,7 @@ int mmalloc_linear_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2){ /* Heap information */ heaplimit = ((struct mdesc *)heap1)->heaplimit; - s_heap = (char *)mmalloc_get_current_heap() - STD_HEAP_SIZE - getpagesize(); + s_heap = (char *)mmalloc_get_current_heap() - STD_HEAP_SIZE - xbt_pagesize; heapbase1 = (char *)heap1 + BLOCKSIZE; heapbase2 = (char *)heap2 + BLOCKSIZE;