- if (mdp) {
- LOCK(mdp);
- ret = mmalloc(mdp, n);
- UNLOCK(mdp);
- // This was already done by mmalloc:
- if (mdp->options & XBT_MHEAP_OPTION_MEMSET) {
- setzero = 0;
- }
-#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) {
- size_t needed_areas = n / JUNK_SIZE;
- if(needed_areas * JUNK_SIZE != n) needed_areas++;
- if (allocated_junk+needed_areas>=MAX_JUNK_AREAS) {
- fprintf(stderr,
- "Panic: real malloc symbol not resolved yet, and I already gave my little private memory chunk away.\n");
- exit(1);
- } else {
- size_t i = allocated_junk;
- allocated_junk += needed_areas;
- ret = junkareas[i];
- }
- }
- else {
-#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;
- }
+#ifdef __FreeBSD__ /* FreeBSD require more memory, other might */
+# define BUFFER_SIZE 256
+#else /* Valid on: Linux */
+# define BUFFER_SIZE 32