Defining the interfaces to add various regions to snapshot
[c11tester.git] / mymemory.cc
index f43f1c35c7e561b1610edfc64899e84a0b07b6ac..c3c67e2812fe9bd2ac20ad3eae85de8c75382d46 100644 (file)
@@ -59,6 +59,7 @@ void *malloc( size_t size ){
        if( NULL == mySpace ){
                //void * mem = MYMALLOC( MSPACE_SIZE );
                mySpace = create_mspace( MSPACE_SIZE, 1 );
+        AddUserHeapToSnapshot();
        }
        return mspace_malloc( mySpace, size );
 }
@@ -67,3 +68,8 @@ void free( void * ptr ){
        mspace_free( mySpace, ptr );
 }
 
+void AddUserHeapToSnapshot(){
+    static bool alreadySnapshotted = false;
+    if( alreadySnapshotted ) return;
+    addMemoryRegionToSnapShot( mySpace, MSPACE_SIZE / PAGESIZE );
+}