Changeset 2703
- Timestamp:
- Dec 13, 2004, 10:49:56 AM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 8 edited
-
psLib.kdevelop.pcs (modified) ( previous)
-
psLib.kdevses (modified) (1 diff)
-
src/sys/psErrorCodes.c (modified) (3 diffs)
-
src/sys/psMemory.c (modified) (2 diffs)
-
src/sysUtils/psErrorCodes.c (modified) (3 diffs)
-
src/sysUtils/psMemory.c (modified) (2 diffs)
-
test/sysUtils/tst_psMemory.c (modified) (3 diffs)
-
test/sysUtils/verified/tst_psMemory.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/psLib.kdevses
r2694 r2703 3 3 <KDevPrjSession> 4 4 <DocsAndViews NumberOfDocuments="2" > 5 <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/ test/astronomy/tst_psMetadataIO.c" >6 <View0 line=" 49" Type="Source" />5 <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psList.c" > 6 <View0 line="39" Type="Source" /> 7 7 </Doc0> 8 <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/ test/astronomy/tst_psMetadata_01.c" >9 <View0 line=" 76" Type="Source" />8 <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psList.h" > 9 <View0 line="0" Type="Source" /> 10 10 </Doc1> 11 11 </DocsAndViews> -
trunk/psLib/src/sys/psErrorCodes.c
r2681 r2703 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-12-1 0 02:50:15$9 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-12-13 20:49:56 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 79 79 while ((desc = (psErrorDescription*)psListGetNext(iter)) != NULL) { 80 80 if (desc->code == code) { 81 psFree(iter); 81 82 return desc; 82 83 } 83 84 } 85 psFree(iter); 84 86 } 85 87 return NULL; … … 140 142 dynamicErrorCodes = psListAlloc(NULL); 141 143 p_psMemSetPersistent(dynamicErrorCodes,true); 144 145 p_psMemSetPersistent(dynamicErrorCodes->iterators,true); 146 p_psMemSetPersistent(dynamicErrorCodes->iterators->data,true); 147 for (int i = 0; i < dynamicErrorCodes->iterators->n;i++) { 148 p_psMemSetPersistent(dynamicErrorCodes->iterators->data[i],true); 149 } 142 150 } 143 151 -
trunk/psLib/src/sys/psMemory.c
r2562 r2703 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.4 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-12- 01 00:56:32$10 * @version $Revision: 1.47 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-12-13 20:49:56 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 431 431 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 432 432 433 psError(PS_ERR_MEMORY_DEREF_USAGE,true, 434 PS_ERRORTEXT_psMemory_MULTIPLE_FREE, 433 psAbort(__func__,PS_ERRORTEXT_psMemory_MULTIPLE_FREE, 435 434 ptr->id, ptr->file, ptr->lineno, file, lineno); 436 437 return; 438 } 435 } 436 437 if (checkMemBlock(ptr, __func__) != 0) { 438 memProblemCallback(ptr, file, lineno); 439 psAbort(__func__,"Memory Corruption Detected."); 440 } 441 439 442 (void)p_psMemDecrRefCounter(vptr, file, lineno); // this handles the free, if required. 440 443 } -
trunk/psLib/src/sysUtils/psErrorCodes.c
r2681 r2703 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-12-1 0 02:50:15$9 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-12-13 20:49:56 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 79 79 while ((desc = (psErrorDescription*)psListGetNext(iter)) != NULL) { 80 80 if (desc->code == code) { 81 psFree(iter); 81 82 return desc; 82 83 } 83 84 } 85 psFree(iter); 84 86 } 85 87 return NULL; … … 140 142 dynamicErrorCodes = psListAlloc(NULL); 141 143 p_psMemSetPersistent(dynamicErrorCodes,true); 144 145 p_psMemSetPersistent(dynamicErrorCodes->iterators,true); 146 p_psMemSetPersistent(dynamicErrorCodes->iterators->data,true); 147 for (int i = 0; i < dynamicErrorCodes->iterators->n;i++) { 148 p_psMemSetPersistent(dynamicErrorCodes->iterators->data[i],true); 149 } 142 150 } 143 151 -
trunk/psLib/src/sysUtils/psMemory.c
r2562 r2703 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.4 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-12- 01 00:56:32$10 * @version $Revision: 1.47 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-12-13 20:49:56 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 431 431 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 432 432 433 psError(PS_ERR_MEMORY_DEREF_USAGE,true, 434 PS_ERRORTEXT_psMemory_MULTIPLE_FREE, 433 psAbort(__func__,PS_ERRORTEXT_psMemory_MULTIPLE_FREE, 435 434 ptr->id, ptr->file, ptr->lineno, file, lineno); 436 437 return; 438 } 435 } 436 437 if (checkMemBlock(ptr, __func__) != 0) { 438 memProblemCallback(ptr, file, lineno); 439 psAbort(__func__,"Memory Corruption Detected."); 440 } 441 439 442 (void)p_psMemDecrRefCounter(vptr, file, lineno); // this handles the free, if required. 440 443 } -
trunk/psLib/test/sysUtils/tst_psMemory.c
r2561 r2703 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 29$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12- 01 00:55:34$8 * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-13 20:49:56 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 46 46 47 47 testDescription tests[] = { 48 { 49 TPCheckBufferPositive, 449, "checkBufferPositive", 0, false 50 }, 51 { 52 TPOutOfMemory, 450, "outOfMemory", -6, false 53 }, 54 { 55 TPReallocOutOfMemory, 562, "reallocOutOfMemory", -6, false 56 }, 57 { 58 TPrealloc, 451, "psRealloc", 0, false 59 }, 60 { 61 TPallocCallback, 452, "allocCallback", 0, false 62 }, 63 { 64 TPallocCallback, 453, "allocCallback2", 0, true 65 }, 66 { 67 TPcheckLeaks, 454, "checkLeaks", 0, false 68 }, 69 { 70 TPmemCorruption, 455, "psMemCorruption", 0, false 71 }, 72 { 73 TPFreeReferencedMemory, 456, "freeReferencedMemory", 0, false 74 }, 75 { 76 TPmultipleFree, 699, "multipleFree", 0, false 77 }, 78 { 79 NULL 80 } 48 {TPCheckBufferPositive, 449, "checkBufferPositive", 0, false}, 49 {TPOutOfMemory, 450, "outOfMemory", -6, false}, 50 {TPReallocOutOfMemory, 562, "reallocOutOfMemory", -6, false}, 51 {TPrealloc, 451, "psRealloc", 0, false}, 52 {TPallocCallback, 452, "allocCallback", 0, false}, 53 {TPallocCallback, 453, "allocCallback2", 0, true}, 54 {TPcheckLeaks, 454, "checkLeaks", 0, false}, 55 {TPmemCorruption, 455, "psMemCorruption", 0, false}, 56 {TPFreeReferencedMemory, 456, "freeReferencedMemory", 0, false}, 57 {TPmultipleFree, 699, "multipleFree", -6, false}, 58 {NULL} 81 59 }; 82 60 83 psS32 main( psS32 argc, char* argv[])61 psS32 main(psS32 argc, char* argv[]) 84 62 { 85 63 psLogSetLevel( PS_LOG_INFO ); … … 550 528 psFree( buffer ); 551 529 552 psLogMsg( __func__, PS_LOG_INFO, "Next should be an error aboutmultiple freeing." );530 psLogMsg( __func__, PS_LOG_INFO, "Next should abort due to multiple freeing." ); 553 531 psFree( buffer ); 554 532 555 psErr* err = (psErr*)psErrorLast(); 556 557 if (err->code != PS_ERR_MEMORY_DEREF_USAGE) { 558 psError(PS_ERR_UNKNOWN,true, 559 "Multiple psFree calls generated wrong error code (%d)", 560 err->code); 561 psFree(err); 562 return 1; 563 } 564 565 psFree(err); 566 567 return 0; 568 } 533 psError(PS_ERR_UNKNOWN,true, 534 "Multiple psFree call survived"); 535 536 return 0; 537 } -
trunk/psLib/test/sysUtils/verified/tst_psMemory.stderr
r2280 r2703 145 145 146 146 <DATE><TIME>|<HOST>|I|TPmultipleFree 147 Next should be an error aboutmultiple freeing.148 <DATE><TIME>|<HOST>| E|p_psFree (psMemory.c:<LINENO>)147 Next should abort due to multiple freeing. 148 <DATE><TIME>|<HOST>|A|p_psFree 149 149 Block 1, allocated at tst_psMemory.c:<LINENO>, freed multiple times at tst_psMemory.c:<LINENO>. 150 150
Note:
See TracChangeset
for help on using the changeset viewer.
