- snapshotrecord = (struct SnapShot *)model_malloc(sizeof(struct SnapShot));
- snapshotrecord->regionsToSnapShot = (struct MemoryRegion *)model_malloc(sizeof(struct MemoryRegion) * nummemoryregions);
- snapshotrecord->backingStoreBasePtr = (void *)model_malloc(sizeof(snapshot_page_t) * (numbackingpages + 1));
- //Page align the backingstorepages
- snapshotrecord->backingStore = (snapshot_page_t *)PageAlignAddressUpward(snapshotrecord->backingStoreBasePtr);
- snapshotrecord->backingRecords = (struct BackingPageRecord *)model_malloc(sizeof(struct BackingPageRecord) * numbackingpages);
- snapshotrecord->snapShots = (struct SnapShotRecord *)model_malloc(sizeof(struct SnapShotRecord) * numsnapshots);
- snapshotrecord->lastSnapShot = 0;
- snapshotrecord->lastBackingPage = 0;
- snapshotrecord->lastRegion = 0;
- snapshotrecord->maxRegions = nummemoryregions;
- snapshotrecord->maxBackingPages = numbackingpages;
- snapshotrecord->maxSnapShots = numsnapshots;
+ model_free(regionsToSnapShot);
+ model_free(backingStoreBasePtr);
+ model_free(backingRecords);
+ model_free(snapShots);