projects
/
model-checker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nodestack: style
[model-checker.git]
/
mymemory.cc
diff --git
a/mymemory.cc
b/mymemory.cc
index 08bd4e437c897967830d5dc760d0d4f27f351b50..e05cb783e2455bdf68aaa5b495fa664e000677f2 100644
(file)
--- a/
mymemory.cc
+++ b/
mymemory.cc
@@
-1,12
+1,17
@@
-#include "mymemory.h"
-#include "snapshot.h"
-#include "snapshotimp.h"
+#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <unistd.h>
#include <stdio.h>
#include <dlfcn.h>
#include <unistd.h>
-#include <cstring>
+#include <string.h>
+#include <new>
+
+#include "mymemory.h"
+#include "snapshot.h"
+#include "snapshotimp.h"
#include "common.h"
#include "common.h"
+
#define REQUESTS_BEFORE_ALLOC 1024
#define REQUESTS_BEFORE_ALLOC 1024
+
size_t allocatedReqs[ REQUESTS_BEFORE_ALLOC ] = { 0 };
int nextRequest = 0;
int howManyFreed = 0;
size_t allocatedReqs[ REQUESTS_BEFORE_ALLOC ] = { 0 };
int nextRequest = 0;
int howManyFreed = 0;
@@
-135,7
+140,7
@@
void * HandleEarlyAllocationRequest(size_t sz)
sz = (sz + 7) & ~7;
if (sz > (BOOTSTRAPBYTES-offset)) {
sz = (sz + 7) & ~7;
if (sz > (BOOTSTRAPBYTES-offset)) {
-
printf
("OUT OF BOOTSTRAP MEMORY\n");
+
model_print
("OUT OF BOOTSTRAP MEMORY\n");
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}
@@
-149,9
+154,7
@@
mspace model_snapshot_space = NULL;
#if USE_MPROTECT_SNAPSHOT
#if USE_MPROTECT_SNAPSHOT
-/** @brief Global mspace reference for the user's snapshotting heap
- * @todo use this ONLY for user's allocations, not for internal snapshotting
- * state */
+/** @brief Global mspace reference for the user's snapshotting heap */
mspace user_snapshot_space = NULL;
/** Check whether this is bootstrapped memory that we should not free */
mspace user_snapshot_space = NULL;
/** Check whether this is bootstrapped memory that we should not free */
@@
-195,7
+198,7
@@
void * calloc(size_t num, size_t size)
return tmp;
} else {
void *tmp = HandleEarlyAllocationRequest(size * num);
return tmp;
} else {
void *tmp = HandleEarlyAllocationRequest(size * num);
-
std::
memset(tmp, 0, size * num);
+ memset(tmp, 0, size * num);
return tmp;
}
}
return tmp;
}
}