Index: /branches/eam_branches/ohana.20160226/src/libohana/include/ohana_allocate.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libohana/include/ohana_allocate.h	(revision 39414)
+++ /branches/eam_branches/ohana.20160226/src/libohana/include/ohana_allocate.h	(revision 39415)
@@ -13,5 +13,5 @@
   int line;		      // line (re)allocated
   int freed;		      // memory has been freed
-  int dummy;		      // need to put endblock on the endpost
+  int Nalloc;		      // need to put endblock on the endpost
   uint32_t endblock;	      // endpost marker
 } OhanaMemblock;
Index: /branches/eam_branches/ohana.20160226/src/libohana/src/ohana_allocate.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libohana/src/ohana_allocate.c	(revision 39414)
+++ /branches/eam_branches/ohana.20160226/src/libohana/src/ohana_allocate.c	(revision 39415)
@@ -55,4 +55,5 @@
   Nelem = MAX (1, Nelem);
   size = Nelem * esize;
+  // if (size % 8) size += (8 - size % 8); // do NOT round to 8-byte boundary (did not fix corruption)
 
   // total size is : memblock + data + endpost
@@ -75,4 +76,5 @@
   new->func = func;
   new->freed = FALSE;
+  new->Nalloc = 1;
 
   // poison the whole memory: we should not rely of 0'ed memory
@@ -129,4 +131,5 @@
   Nelem = MAX (1, Nelem);
   size = Nelem * esize;
+  // if (size % 8) size += (8 - size % 8); // do NOT round to 8-byte boundary (did not fix corruption)
 
   // requested same size as current allocation
@@ -134,4 +137,5 @@
     return in;
   }
+  size_t oldsize = old->size;
 
   pthread_mutex_lock(&memBlockListMutex);
@@ -156,4 +160,7 @@
   new->nextBlock = old->nextBlock;
   new->prevBlock = old->prevBlock;
+  new->startblock = OHANA_MEMMAGIC;
+  new->endblock = OHANA_MEMMAGIC;
+  new->freed = FALSE;
 # else
   // ask for new memory
@@ -164,8 +171,6 @@
 # endif
   
-  // set the end-post values
-  new->startblock = OHANA_MEMMAGIC;
-  new->endblock = OHANA_MEMMAGIC;
-  *(uint32_t *)(ptr_new + size) = OHANA_MEMMAGIC;
+  if (new->startblock != OHANA_MEMMAGIC) ohana_memabort ("corrupt memory (%s, %d, %s)\n", file, line, func);
+  if (new->endblock != OHANA_MEMMAGIC) ohana_memabort ("corrupt memory (%s, %d, %s)\n", file, line, func);
 
   // set the memory metadata
@@ -174,8 +179,13 @@
   new->line = line;
   new->func = func;
-  new->freed = FALSE;
-
-  // update the endpost (the others were set originally
+  new->Nalloc++;
+
+  // update the endpost (the others were set originally and maintained through the realloc)
   *(uint32_t *)(ptr_new + size) = OHANA_MEMMAGIC;
+
+  // poison the new memory: we should not rely of 0'ed memory
+  if (new->size > oldsize) {
+    memset (&ptr_new[oldsize], 0x7f, new->size - oldsize);
+  }
 
   // need to reset lastBlock in case we moved
