Changeset 10888 for branches/jch-memory/psLib/src/sys/psMemory.c
- Timestamp:
- Jan 2, 2007, 6:46:32 PM (19 years ago)
- File:
-
- 1 edited
-
branches/jch-memory/psLib/src/sys/psMemory.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/jch-memory/psLib/src/sys/psMemory.c
r10887 r10888 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.88.2. 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-01-03 04: 30:32 $10 * @version $Revision: 1.88.2.4 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-01-03 04:46:32 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 25 25 #include "psError.h" 26 26 #include "psAssert.h" 27 #include "psAbort.h"28 27 #include "psLogMsg.h" 29 28 #include "psBitSet.h" … … 48 47 } 49 48 49 // psAbort() calls functions that call psAlloc() so it is *UNSAFE* to use it 50 // from within the memory subsystem. Previous implementations tried to do 51 // this and would deadlock while trying to allocate memory. 52 #define PS_MEM_ABORT(name, ...) \ 53 fprintf(stderr, "Memory Management Error. This error can not be logged.\n") ;\ 54 fprintf(stderr, __VA_ARGS__);\ 55 fprintf(stderr, "\n");\ 56 abort(); 57 50 58 static psS32 checkMemBlock(const psMemBlock* m, const char *funcName); 51 59 static psMemBlock* lastMemBlockAllocated = NULL; … … 107 115 108 116 if (lineno > 0) { 109 psAbort(__func__, "Detected a problem in the memory system at %s:%d", file, lineno);117 PS_MEM_ABORT(__func__, "Detected a problem in the memory system at %s:%d", file, lineno); 110 118 } 111 119 } … … 299 307 // release the lock on the memblock list 300 308 MUTEX_UNLOCK(&memBlockListMutex); 301 psAbort(__func__, "Detected memory corruption");309 PS_MEM_ABORT(__func__, "Detected memory corruption"); 302 310 return nbad; 303 311 } … … 338 346 ptr = memExhaustedCallback(size); 339 347 if (ptr == NULL) { 340 psAbort(__func__, "Failed to allocate %zd bytes at %s:%d", size, file, lineno);348 PS_MEM_ABORT(__func__, "Failed to allocate %zd bytes at %s:%d", size, file, lineno); 341 349 } 342 350 } … … 396 404 if (checkMemBlock(ptr, __func__) != 0) { 397 405 memProblemCallback(ptr, file, lineno); 398 psAbort(file, "Realloc detected a memory corruption (id %lu @ %s:%d).",399 (unsigned long)ptr->id, ptr->file, ptr->lineno);406 PS_MEM_ABORT(file, "Realloc detected a memory corruption (id %lu @ %s:%d).", 407 (unsigned long)ptr->id, ptr->file, ptr->lineno); 400 408 } 401 409 … … 414 422 ptr = memExhaustedCallback(size); 415 423 if (ptr == NULL) { 416 psAbort(__func__, "Failed to reallocate %zd bytes at %s:%d", size, file, lineno);424 PS_MEM_ABORT(__func__, "Failed to reallocate %zd bytes at %s:%d", size, file, lineno); 417 425 } 418 426 } … … 454 462 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 455 463 456 psAbort(__func__,_("Block %lu, allocated at %s:%d, freed multiple times at %s:%d."),457 (unsigned long)ptr->id, ptr->file, ptr->lineno, filename, lineno);464 PS_MEM_ABORT(__func__,_("Block %lu, allocated at %s:%d, freed multiple times at %s:%d."), 465 (unsigned long)ptr->id, ptr->file, ptr->lineno, filename, lineno); 458 466 } 459 467 460 468 if (checkMemBlock(ptr, __func__) != 0) { 461 469 memProblemCallback(ptr, filename, lineno); 462 psAbort(__func__,"Memory Corruption Detected.");470 PS_MEM_ABORT(__func__,"Memory Corruption Detected."); 463 471 } 464 472
Note:
See TracChangeset
for help on using the changeset viewer.
