$(CXX) $(SHARED) -o $(LIB_SO) $(OBJECTS) $(LDFLAGS)
malloc.o: malloc.c
- $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES $(CPPFLAGS)
+ $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES -DHAVE_MMAP=0 $(CPPFLAGS)
%.o: %.cc
$(CXX) -fPIC -c $< $(CPPFLAGS)
main_argv = argv;
/* Let's jump in quickly and start running stuff */
- initSnapShotLibrary(10000, 1024, 1024, 1000, &real_main);
+ initSnapShotLibrary(10000, 1024, 1024, 4000, &real_main);
}
/** Snapshotting malloc implementation for user programs. */
void *malloc( size_t size ) {
if (mySpace) {
- return mspace_malloc( mySpace, size );
+ void *tmp=mspace_malloc( mySpace, size );
+ ASSERT(tmp);
+ return tmp;
} else
return HandleEarlyAllocationRequest( size );
}
/** Snapshotting realloc implementation for user programs. */
void *realloc( void *ptr, size_t size ){
- return mspace_realloc( mySpace, ptr, size );
+ void *tmp=mspace_realloc( mySpace, ptr, size );
+ ASSERT(tmp);
+ return tmp;
}
/** Snapshotting calloc implementation for user programs. */
void * calloc( size_t num, size_t size ){
- if (mySpace)
- return mspace_calloc( mySpace, num, size );
- else {
+ if (mySpace) {
+ void *tmp=mspace_calloc( mySpace, num, size );
+ ASSERT(tmp);
+ return tmp;
+ } else {
void *tmp=HandleEarlyAllocationRequest( size * num );
std::memset( tmp, 0, size * num );
return tmp;
#include <sys/mman.h>
#include <sys/types.h>
#include <csignal>
-#define SHARED_MEMORY_DEFAULT (100 * ((size_t)1 << 20)) // 100mb for the shared memory
+#define SHARED_MEMORY_DEFAULT (100 * ((size_t)1 << 20)) // 100mb for the shared memory
#define STACK_SIZE_DEFAULT (((size_t)1 << 20) * 20) // 20 mb out of the above 100 mb for my stack
#if USE_MPROTECT_SNAPSHOT