Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
better to use a function that exists than dealing with the underlying
[simgrid.git] / src / mc / mc_checkpoint.c
index 521b95a..6f53924 100644 (file)
@@ -113,12 +113,16 @@ void MC_take_snapshot(mc_snapshot_t snapshot)
 }
 
 void MC_init_memory_map_info(){
+
+  raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
+
+  MC_SET_RAW_MEM;
   
   unsigned int i = 0;
   s_map_region_t reg;
   memory_map_t maps = get_memory_map();
 
-   while (i < maps->mapsize) {
+  while (i < maps->mapsize) {
     reg = maps->regions[i];
     if ((reg.prot & PROT_WRITE)){
       if (maps->regions[i].pathname == NULL){
@@ -144,6 +148,13 @@ void MC_init_memory_map_info(){
     }
     i++;
   }
+  
+  free_memory_map(maps);
+
+  MC_UNSET_RAW_MEM;
+
+  if(raw_mem_set)
+    MC_SET_RAW_MEM;
 
 }
 
@@ -603,3 +614,9 @@ static void snapshot_stack_free(mc_snapshot_stack_t s){
 void snapshot_stack_free_voidp(void *s){
   snapshot_stack_free((mc_snapshot_stack_t) * (void **) s);
 }
+
+void *MC_snapshot(void){
+
+  return simcall_mc_snapshot();
+  
+}