From 3b83099adfbb07a89843ad15c9c1b8f8a62c4893 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Fri, 16 May 2014 09:42:55 +0200 Subject: [PATCH 1/1] [mc] Comments/documentation of memory related code --- src/xbt/mmalloc/mm_diff.c | 10 +++++++++- src/xbt/mmalloc/mmprivate.h | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/xbt/mmalloc/mm_diff.c b/src/xbt/mmalloc/mm_diff.c index af5bd8853e..a079804c63 100644 --- a/src/xbt/mmalloc/mm_diff.c +++ b/src/xbt/mmalloc/mm_diff.c @@ -134,7 +134,12 @@ static int compare_backtrace(int b1, int f1, int b2, int f2){ typedef char* type_name; struct s_mm_diff { - void *s_heap, *heapbase1, *heapbase2; + /** \brief Base address of the real heap */ + void *s_heap; + /** \brief Base address of the first heap snapshot */ + void *heapbase1; + /** \brief Base address of the second heap snapshot */ + void *heapbase2; malloc_info *heapinfo1, *heapinfo2; size_t heaplimit; // Number of blocks in the heaps: @@ -328,6 +333,9 @@ int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t i1, state->heaplimit = ((struct mdesc *)heap1)->heaplimit; + // Mamailloute in order to find the base address of the main heap: + // This heavily depends on the structure of MC: we need to move this code into MC. + // (STD_HEAP_SIZE comes from mc.h anyway) state->s_heap = (char *)mmalloc_get_current_heap() - STD_HEAP_SIZE - xbt_pagesize; state->heapbase1 = (char *)heap1 + BLOCKSIZE; diff --git a/src/xbt/mmalloc/mmprivate.h b/src/xbt/mmalloc/mmprivate.h index 37e4ea718d..dd3856abbd 100644 --- a/src/xbt/mmalloc/mmprivate.h +++ b/src/xbt/mmalloc/mmprivate.h @@ -240,7 +240,9 @@ struct mdesc { void *breakval; /* The end of the current memory region for this malloc heap. This is - the first location past the end of mapped memory. */ + the first location past the end of mapped memory. + Compared to breakval, this value is rounded to the next memory page. + */ void *top; -- 2.20.1