Changeset 1097 for trunk/psLib/test/sysUtils/tst_psMemory.c
- Timestamp:
- Jun 25, 2004, 11:51:46 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/sysUtils/tst_psMemory.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sysUtils/tst_psMemory.c
r1075 r1097 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06-2 4 00:54:59$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-25 21:51:46 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static int TPFreeReferencedMemory(void); 29 29 static int TPOutOfMemory(void); 30 static int TPReallocOutOfMemory(void); 30 31 static void* TPOutOfMemoryExhaustedCallback(size_t size); 31 32 static int TPCheckBufferPositive(void); … … 46 47 {TPCheckBufferPositive,"449-TPCheckBufferPositive",0}, 47 48 {TPOutOfMemory,"450-TPOutOfMemory",-6}, 49 {TPReallocOutOfMemory,"562-TPReallocOutOfMemory",-6}, 48 50 {TPrealloc,"451-TPrealloc",0}, 49 51 {TPallocCallback,"452/453-TPallocCallback",0}, … … 145 147 } 146 148 149 // Bug/Task #562 regression test. Upon requesting more memory than is available, psRealloc shall call 150 // the psMemExhaustedCallback. 151 int TPReallocOutOfMemory(void) 152 { 153 int* mem[100]; 154 psMemExhaustedCallback cb; 155 156 for (int lcv = 0; lcv<100; lcv++) { 157 mem[lcv] = NULL; 158 } 159 160 psLogMsg(__func__,PS_LOG_INFO,"Upon requesting more memory than is available, psRealloc shall call " 161 "the psMemExhaustedCallback.\n"); 162 163 exhaustedCallbackCalled = 0; 164 165 cb = psMemExhaustedCallbackSet(TPOutOfMemoryExhaustedCallback); 166 167 for (int lcv = 0; lcv<100; lcv++) { 168 mem[lcv] = (int*) psAlloc(10); 169 } 170 171 for (int lcv = 0; lcv<100; lcv++) { 172 mem[lcv] = (int*) psRealloc(mem[lcv],SIZE_MAX-1000); 173 } 174 175 psMemExhaustedCallbackSet(cb); 176 177 if (exhaustedCallbackCalled == 0) { 178 psError(__FILE__,"Called psRealloc with HUGE memory requirement and survived in %s!",__func__); 179 return 1; 180 } 181 182 for (int lcv = 0; lcv<100; lcv++) { 183 psFree(mem[lcv]); 184 } 185 186 return 0; 187 } 147 188 // Testpoint #450, Upon requesting more memory than is available, psalloc shall call 148 189 // the psMemExhaustedCallback.
Note:
See TracChangeset
for help on using the changeset viewer.
