Index: /branches/eam_branches/ohana.20170809/src/libohana/src/ohana_allocate.c
===================================================================
--- /branches/eam_branches/ohana.20170809/src/libohana/src/ohana_allocate.c	(revision 40114)
+++ /branches/eam_branches/ohana.20170809/src/libohana/src/ohana_allocate.c	(revision 40115)
@@ -47,4 +47,6 @@
 }
 
+int NdumpFile = 0;
+
 void *ohana_malloc (const char *file, int line, const char *func, size_t Nelem, size_t esize) {
 
@@ -53,6 +55,9 @@
   size_t size;		      // total number of bytes requested (not items)
 
+  fprintf (stderr, "malloc: lastBlock: 0x%08lx, Nblock %d, Nelem: %zd, esize: %zd, (%s@%d : %s)\n", (long int) lastBlock, Nblock, Nelem, esize, file, line, func);
+
   Nelem = MAX (1, Nelem);
   size = Nelem * esize;
+  if (!size) abort();
   // if (size % 8) size += (8 - size % 8); // do NOT round to 8-byte boundary (did not fix corruption)
 
@@ -78,4 +83,6 @@
   new->Nalloc = 1;
 
+  if (!new->size) abort();
+
   // poison the whole memory: we should not rely of 0'ed memory
   memset (ptr, 0x7f, new->size);
@@ -91,10 +98,16 @@
   // lastBlock = m2
 
+//  if (!new->size) abort();
+
   // set up the pointers
   new->nextBlock = NULL;
 
+//  if (!new->size) abort();
+
   // protect the list during this operation
   pthread_mutex_lock(&memBlockListMutex);
 
+  if (!new->size) abort();
+
   if (lastBlock) {
     lastBlock->nextBlock = new;
@@ -103,8 +116,21 @@
   lastBlock = new;
 
+  if (!new->size) abort();
+
   Nblock ++;
   pthread_mutex_unlock(&memBlockListMutex);
 
   if (!new->nextBlock && !new->prevBlock && (Nblock > 1)) abort();
+
+  if (!new->size) abort();
+
+  if (0) { 
+    char tmpname[1024];
+    snprintf (tmpname, 1024, "dvopsps.memdump.%03d.txt", NdumpFile);
+    FILE *fdmp = fopen (tmpname, "w");
+    ohana_memdump_file (fdmp, TRUE);
+    fclose (fdmp);
+    NdumpFile ++;
+  }
 
   return (ptr);
@@ -116,4 +142,6 @@
   OhanaMemblock *new;	      // new memblock associated with user memory
   size_t size;
+
+  fprintf (stderr, "realloc: lastBlock: 0x%08lx, Nblock %d, Nelem: %zd, esize: %zd, (%s@%d : %s)\n", (long int) lastBlock, Nblock, Nelem, esize, file, line, func);
 
   // just allocate if not previously allocated
@@ -229,4 +257,6 @@
   OhanaMemblock *ref;
 
+  fprintf (stderr, "free: lastBlock: 0x%08lx, Nblock %d, freeBlock: 0x%08lx, (%s@%d : %s)\n", (long int) lastBlock, Nblock, (long int) in, file, line, func);
+
   if (!in) return;
 
@@ -454,5 +484,5 @@
   if (Ntotal_drop || VERBOSE) {
     fprintf (stderr, "%zd memory blocks dropped   (%zd bytes total), %zd good, %zd bad", Ntotal_drop, Nbytes_drop, Ngood_drop, Nbad_drop);
-    fprintf (stderr, "@ %s:%d (%d)\n", myFile, myLine, myFunc);
+    fprintf (stderr, "@ %s:%d (%s)\n", myFile, myLine, myFunc);
   }
 
@@ -513,7 +543,8 @@
     if (Ntotal < 100) {
       if (good) {
-	fprintf (f, "  %zd  %zd  %zd  GOOD  %s %d, func: %s\n", Ntotal, thisBlock->size, Nbytes, thisBlock->file, thisBlock->line, thisBlock->func);
+// fprintf (f, "  %zd  %zd  %zd  0x%08lx, GOOD  %s %d, func: %s\n", Ntotal, thisBlock->size, Nbytes, (long int) thisBlock, thisBlock->file, thisBlock->line, thisBlock->func);
+	fprintf (f, "  %zd  %zd  %zd GOOD  %s %d, func: %s\n", Ntotal, thisBlock->size, Nbytes, thisBlock->file, thisBlock->line, thisBlock->func);
       } else {
-	fprintf (f, "  %zd  %zd  %zd  BAD   %s %d, func: %s\n", Ntotal, thisBlock->size, Nbytes, thisBlock->file, thisBlock->line, thisBlock->func);
+	fprintf (f, "  %zd  %zd  %zd  BAD  %s %d, func: %s\n", Ntotal, thisBlock->size, Nbytes, thisBlock->file, thisBlock->line, thisBlock->func);
       }
     }
