Index: trunk/psLib/src/sys/psMemory.c
===================================================================
--- trunk/psLib/src/sys/psMemory.c	(revision 9538)
+++ trunk/psLib/src/sys/psMemory.c	(revision 10276)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.86 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-10-13 21:13:48 $
+*  @version $Revision: 1.87 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-11-29 17:58:21 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -182,4 +182,21 @@
 }
 
+
+/*
+ * A callback function to check the state of the memory system; may be registered
+ * with psMem{Alloc,Free}CallbackSet
+ */
+static psMemId memAllocCallbackCheckCorruption(const psMemBlock *ptr)
+{
+    static psMemId incr = 10; // "p_psMemAllocID += incr"
+    bool abort_on_error = false;
+
+    if (psMemCheckCorruption(abort_on_error) > 0) {
+        fprintf(stderr,"Detected memory corruption\n"); // somewhere to set a breakpoint
+    }
+
+    return incr;
+}
+
 /*
  * The default callbacks
@@ -227,4 +244,9 @@
 {
     psMemId old = p_psMemAllocID;
+
+    /*
+     * This is here purely to stop gcc complaining
+     */
+    assert (memAllocCallbackCheckCorruption != NULL);
 
     p_psMemAllocID = id;
