Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Comments/documentation of memory related code
authorGabriel Corona <gabriel.corona@loria.fr>
Fri, 16 May 2014 07:42:55 +0000 (09:42 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 16 May 2014 09:24:49 +0000 (11:24 +0200)
src/xbt/mmalloc/mm_diff.c
src/xbt/mmalloc/mmprivate.h

index af5bd88..a079804 100644 (file)
@@ -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;
index 37e4ea7..dd3856a 100644 (file)
@@ -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;