Index: /trunk/psLib/test/sysUtils/tst_psMemory.c
===================================================================
--- /trunk/psLib/test/sysUtils/tst_psMemory.c	(revision 1096)
+++ /trunk/psLib/test/sysUtils/tst_psMemory.c	(revision 1097)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-24 00:54:59 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-25 21:51:46 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,4 +28,5 @@
 static int TPFreeReferencedMemory(void);
 static int TPOutOfMemory(void);
+static int TPReallocOutOfMemory(void);
 static void* TPOutOfMemoryExhaustedCallback(size_t size);
 static int TPCheckBufferPositive(void);
@@ -46,4 +47,5 @@
                               {TPCheckBufferPositive,"449-TPCheckBufferPositive",0},
                               {TPOutOfMemory,"450-TPOutOfMemory",-6},
+                              {TPReallocOutOfMemory,"562-TPReallocOutOfMemory",-6},
                               {TPrealloc,"451-TPrealloc",0},
                               {TPallocCallback,"452/453-TPallocCallback",0},
@@ -145,4 +147,43 @@
 }
 
+// Bug/Task #562 regression test.  Upon requesting more memory than is available, psRealloc shall call
+// the psMemExhaustedCallback.
+int TPReallocOutOfMemory(void)
+{
+    int* mem[100];
+    psMemExhaustedCallback cb;
+
+    for (int lcv = 0; lcv<100; lcv++) {
+        mem[lcv] = NULL;
+    }
+
+    psLogMsg(__func__,PS_LOG_INFO,"Upon requesting more memory than is available, psRealloc shall call "
+             "the psMemExhaustedCallback.\n");
+
+    exhaustedCallbackCalled = 0;
+
+    cb = psMemExhaustedCallbackSet(TPOutOfMemoryExhaustedCallback);
+
+    for (int lcv = 0; lcv<100; lcv++) {
+        mem[lcv] = (int*) psAlloc(10);
+    }
+
+    for (int lcv = 0; lcv<100; lcv++) {
+        mem[lcv] = (int*) psRealloc(mem[lcv],SIZE_MAX-1000);
+    }
+
+    psMemExhaustedCallbackSet(cb);
+
+    if (exhaustedCallbackCalled == 0) {
+        psError(__FILE__,"Called psRealloc with HUGE memory requirement and survived in %s!",__func__);
+        return 1;
+    }
+
+    for (int lcv = 0; lcv<100; lcv++) {
+        psFree(mem[lcv]);
+    }
+
+    return 0;
+}
 // Testpoint #450,  Upon requesting more memory than is available, psalloc shall call
 // the psMemExhaustedCallback.
Index: /trunk/psLib/test/sysUtils/verified/tst_psMemory.stderr
===================================================================
--- /trunk/psLib/test/sysUtils/verified/tst_psMemory.stderr	(revision 1096)
+++ /trunk/psLib/test/sysUtils/verified/tst_psMemory.stderr	(revision 1097)
@@ -17,7 +17,19 @@
  <DATE> <TIME> <HOST> |I|  TPOutOfMemory|Upon requesting more memory than is available, psalloc shall call the psMemExhaustedCallback.
  <DATE> <TIME> <HOST> |I|TPOutOfMemoryEx|Custom MemExhaustedCallback was invoked.
- <DATE> <TIME> <HOST> |A|      p_psAlloc|Failed to allocate 4294966295 bytes at tst_psMemory.c:166
+ <DATE> <TIME> <HOST> |A|      p_psAlloc|Failed to allocate 4294966295 bytes at tst_psMemory.c:207
 
 ---> TESTPOINT PASSED (psMemory{450-TPOutOfMemory} | tst_psMemory.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psMemory.c                                             *
+*            TestPoint: psMemory{562-TPReallocOutOfMemory}                         *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+ <DATE> <TIME> <HOST> |I|TPReallocOutOfM|Upon requesting more memory than is available, psRealloc shall call the psMemExhaustedCallback.
+ <DATE> <TIME> <HOST> |I|TPOutOfMemoryEx|Custom MemExhaustedCallback was invoked.
+ <DATE> <TIME> <HOST> |A|    p_psRealloc|Failed to reallocate -1001 bytes at tst_psMemory.c:172
+
+---> TESTPOINT PASSED (psMemory{562-TPReallocOutOfMemory} | tst_psMemory.c)
 
 /***************************** TESTPOINT ******************************************\
@@ -59,14 +71,14 @@
  <DATE> <TIME> <HOST> |I|   TPcheckLeaks|following psMemCheckLeaks call should produce one instance.
                    file:line ID
-         tst_psMemory.c:316  1
+         tst_psMemory.c:357  1
  <DATE> <TIME> <HOST> |I|   TPcheckLeaks|Testing psMemCheckLeaks again with a different leak location
  <DATE> <TIME> <HOST> |I|   TPcheckLeaks|following psMemCheckLeaks call should produce one error.
                    file:line ID
-         tst_psMemory.c:346  11
+         tst_psMemory.c:387  11
  <DATE> <TIME> <HOST> |I|   TPcheckLeaks|Testing psMemCheckLeaks again with multiple leak locations.
  <DATE> <TIME> <HOST> |I|   TPcheckLeaks|following psMemCheckLeaks call should produce two errors.
                    file:line ID
-         tst_psMemory.c:374  16
-         tst_psMemory.c:374  14
+         tst_psMemory.c:415  16
+         tst_psMemory.c:415  14
 
 ---> TESTPOINT PASSED (psMemory{454-TPcheckLeaks} | tst_psMemory.c)
@@ -81,5 +93,5 @@
  <DATE> <TIME> <HOST> |I|TPmemCorruption|psMemCheckCorruption should output an error message and memProblemCallback callback should be called.
  <DATE> <TIME> <HOST> |E|psMemCheckCorru|psMemCheckCorruption: memory block 1 is corrupted (buffer underflow)
- <DATE> <TIME> <HOST> |I|memProblemCallb|memory callback called for id 1 (psMemCheckCorruption:226).
+ <DATE> <TIME> <HOST> |I|memProblemCallb|memory callback called for id 1 (psMemCheckCorruption:221).
 
 ---> TESTPOINT PASSED (psMemory{455-TPmemCorruption} | tst_psMemory.c)
