/* 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
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;
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; j<MAX_FRAGMENT_PER_BLOCK; j++)
- equals_to1[i][j] = NULL;
- }
-
- equals_to2 = malloc(heaplimit * sizeof(heap_area_t *));
- for(i=0; i<=heaplimit; i++){
- equals_to2[i] = malloc(MAX_FRAGMENT_PER_BLOCK * sizeof(heap_area_t));
- for(j=0; j<MAX_FRAGMENT_PER_BLOCK; j++)
- equals_to2[i][j] = NULL;
- }
-
types1 = malloc(heaplimit * sizeof(type_name *));
for(i=0; i<=heaplimit; i++){
+ equals_to1[i] = malloc(MAX_FRAGMENT_PER_BLOCK * sizeof(heap_area_t));
types1[i] = malloc(MAX_FRAGMENT_PER_BLOCK * sizeof(type_name));
- for(j=0; j<MAX_FRAGMENT_PER_BLOCK; j++)
+ for(j=0; j<MAX_FRAGMENT_PER_BLOCK; j++){
+ equals_to1[i][j] = NULL;
types1[i][j] = NULL;
+ }
}
+ equals_to2 = malloc(heaplimit * sizeof(heap_area_t *));
types2 = malloc(heaplimit * sizeof(type_name *));
for(i=0; i<=heaplimit; i++){
+ equals_to2[i] = malloc(MAX_FRAGMENT_PER_BLOCK * sizeof(heap_area_t));
types2[i] = malloc(MAX_FRAGMENT_PER_BLOCK * sizeof(type_name));
- for(j=0; j<MAX_FRAGMENT_PER_BLOCK; j++)
+ for(j=0; j<MAX_FRAGMENT_PER_BLOCK; j++){
+ equals_to2[i][j] = NULL;
types2[i][j] = NULL;
+ }
}
if(MC_is_active()){
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);
}
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);
}
/* 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;