/** @brief Snapshotting malloc, for use by model-checker (not user progs) */
void * snapshot_malloc(size_t size)
{
- return malloc(size);
+ void *tmp = mspace_malloc(model_snapshot_space, size);
+ ASSERT(tmp);
+ return tmp;
}
/** @brief Snapshotting calloc, for use by model-checker (not user progs) */
void * snapshot_calloc(size_t count, size_t size)
{
- return calloc(count, size);
+ void *tmp = mspace_calloc(model_snapshot_space, count, size);
+ ASSERT(tmp);
+ return tmp;
+}
+
+/** @brief Snapshotting realloc, for use by model-checker (not user progs) */
+void *snapshot_realloc(void *ptr, size_t size)
+{
+ void *tmp = mspace_realloc(model_snapshot_space, ptr, size);
+ ASSERT(tmp);
+ return tmp;
}
/** @brief Snapshotting free, for use by model-checker (not user progs) */
void snapshot_free(void *ptr)
{
- free(ptr);
+ mspace_free(model_snapshot_space, ptr);
}
/** Non-snapshotting free for our use. */
void * snapshot_malloc(size_t size);
void * snapshot_calloc(size_t count, size_t size);
+void * snapshot_realloc(void *ptr, size_t size);
void snapshot_free(void *ptr);
/** @brief Provides a non-snapshotting allocator for use in STL classes.