+ if (mdp) {
+ LOCK(mdp);
+ ret = mmalloc(mdp, n);
+ UNLOCK(mdp);
+#ifdef MM_LEGACY_VERBOSE
+ if (!warned_mmalloc) {
+ fprintf(stderr,"Using mmalloc; enabling the model-checker in cmake may have a bad impact on your simulation performance\n");
+ warned_mmalloc = 1;
+ }
+#endif
+ } else {
+ if (!real_malloc) {
+ if (allocated_junk) {
+ fprintf(stderr,
+ "Panic: real malloc symbol not resolved yet, and I already gave my little private memory chunk away. "
+ "Damn LD, we must extend our code to have several such areas.\n");
+ exit(1);
+ } else if (n > sizeof junkarea) {
+ fprintf(stderr,
+ "Panic: real malloc symbol not resolved yet, and I need %zu bytes while my little private memory chunk is only %zu bytes wide. "
+ "Damn LD, we must fix our code to extend this area.\n", n, sizeof junkarea);
+ exit(1);
+ } else {
+ allocated_junk = 1;
+ return junkarea;
+ }
+ }
+#ifdef MM_LEGACY_VERBOSE
+ if (!warned_raw) {
+ fprintf(stderr,"Using system malloc after interception; you seem to be currently model-checking\n");
+ warned_raw = 1;
+ }
+#endif
+ ret = real_malloc(n);
+ }
+ return ret;
+}