free(ptr);
}
-void *system_malloc(size_t size)
-{
- static void *(*mallocp)(size_t size);
- char *error;
- void *ptr;
-
- /* get address of libc malloc */
- if (!mallocp) {
- mallocp = (void * (*)(size_t))dlsym(RTLD_NEXT, "malloc");
- if ((error = dlerror()) != NULL) {
- fputs(error, stderr);
- exit(EXIT_FAILURE);
- }
- }
- ptr = mallocp(size);
- return ptr;
-}
-
/** Non-snapshotting free for our use. */
void model_free(void *ptr)
{
void * snapshot_calloc(size_t count, size_t size);
void snapshot_free(void *ptr);
-void *system_malloc(size_t size );
-
/** @brief Provides a non-snapshotting allocator for use in STL classes.
*
* The code was adapted from a code example from the book The C++