Changeset 4589 for trunk/psLib/src/sys/psMemory.c
- Timestamp:
- Jul 20, 2005, 3:40:10 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psMemory.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psMemory.c
r4556 r4589 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-07- 15 02:33:54$10 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-07-21 01:40:10 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 102 102 } 103 103 104 static void memProblemCallbackDefault( psMemBlock* ptr, const char *file, unsigned int lineno) 104 static void memProblemCallbackDefault(psMemBlock* ptr, 105 const char *file, 106 unsigned int lineno) 105 107 { 106 108 if (ptr->refCounter < 1) { … … 120 122 * N.b. If the block wasn't allocated by psAlloc, it will appear corrupted 121 123 */ 122 static psS32 checkMemBlock(const psMemBlock* m, const char *funcName) 124 static psS32 checkMemBlock(const psMemBlock* m, 125 const char *funcName) 123 126 { 124 127 // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked, … … 286 289 } 287 290 288 psPtr p_psAlloc(size_t size, const char *file, unsigned int lineno) 291 psPtr p_psAlloc(size_t size, 292 const char *file, 293 unsigned int lineno) 289 294 { 290 295 … … 370 375 } 371 376 372 psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, unsigned int lineno) 377 psPtr p_psRealloc(psPtr vptr, 378 size_t size, 379 const char *file, 380 unsigned int lineno) 373 381 { 374 382 size = (size < recycleBinSize[0]) ? recycleBinSize[0] : size; // set the minimum size to allocate … … 424 432 } 425 433 426 void p_psFree(psPtr vptr, const char *file, unsigned int lineno) 434 void p_psFree(psPtr vptr, 435 const char *filename, 436 unsigned int lineno) 427 437 { 428 438 if (vptr == NULL) { … … 434 444 435 445 psAbort(__func__,PS_ERRORTEXT_psMemory_MULTIPLE_FREE, 436 ptr->id, ptr->file, ptr->lineno, file , lineno);446 ptr->id, ptr->file, ptr->lineno, filename, lineno); 437 447 } 438 448 439 449 if (checkMemBlock(ptr, __func__) != 0) { 440 memProblemCallback(ptr, file , lineno);450 memProblemCallback(ptr, filename, lineno); 441 451 psAbort(__func__,"Memory Corruption Detected."); 442 452 } 443 453 444 (void)p_psMemDecrRefCounter(vptr, file , lineno); // this handles the free, if required.454 (void)p_psMemDecrRefCounter(vptr, filename, lineno); // this handles the free, if required. 445 455 } 446 456 … … 448 458 * Check for memory leaks. 449 459 */ 450 psS32 psMemCheckLeaks(psMemId id0, psMemBlock* ** arr, FILE * fd, psBool persistence) 460 int psMemCheckLeaks(psMemId id0, 461 psMemBlock* ** arr, 462 FILE * fd, 463 psBool persistence) 451 464 { 452 465 psS32 nleak = 0; … … 527 540 528 541 // increment and return refCounter 529 psPtr p_psMemIncrRefCounter(psPtr vptr, const char *file, psS32 lineno) 542 psPtr p_psMemIncrRefCounter(psPtr vptr, 543 const char *file, 544 psS32 lineno) 530 545 { 531 546 psMemBlock* ptr; … … 549 564 550 565 // decrement and return refCounter 551 psPtr p_psMemDecrRefCounter(psPtr vptr, const char *file, psS32 lineno) 566 psPtr p_psMemDecrRefCounter(psPtr vptr, 567 const char *file, 568 psS32 lineno) 552 569 { 553 570 if (vptr == NULL) { … … 640 657 } 641 658 642 void psMemSetDeallocator(psPtr ptr, psFreeFunc freeFunc) 659 void psMemSetDeallocator(psPtr ptr, 660 psFreeFunc freeFunc) 643 661 { 644 662 if (ptr == NULL) { … … 655 673 656 674 } 657 psFreeFunc psMemGetDeallocator( psPtr ptr)675 psFreeFunc psMemGetDeallocator(const psPtr ptr) 658 676 { 659 677 if (ptr == NULL) { … … 685 703 } 686 704 687 void p_psMemSetPersistent(psPtr vptr, bool value) 705 void p_psMemSetPersistent(psPtr vptr, 706 bool value) 688 707 { 689 708 if (vptr == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.
