IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 4, 2007, 11:09:32 AM (20 years ago)
Author:
jhoblitt
Message:

comment/doc updates
add PS_MEM_ABORT_CORRUPT macro to replace several calls to memProblemCallBack()
remove the funcname parameter from badMemBlock()
remove memIdMutex (use memBlockListMutex instead)
remove PS_MEM_DEBUG & deadBlockList (unused)
improve naming consistency of variables & function parameters
remove memProblemCallbackDefault()
remove psMemProblemCallbackSet()
add mutex locking all over the place
add func parameter to p_psAlloc()
add func parameter to p_psRealloc(0
reorganize p_psAlloc(), p_psRealloc()
remove p_psFree, superseded by p_psMemDecrRefCounter()
tidy up psMemCheckType() to reduce the number of lines of code
add tid (thread ID) & func (function name) fields to psMemBlock
change psFree macro to call p_psMemDecrRefCounter()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/jch-memory/psLib/src/sys/psMemory.h

    r10896 r10899  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.61.2.2 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2007-01-03 22:25:33 $
     14 *  @version $Revision: 1.61.2.3 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2007-01-04 21:09:32 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7272    size_t userMemorySize;             ///< the size of the user-portion of the memory block
    7373    const psMemId id;                  ///< a unique ID for this allocation
     74    const pthread_t tid;               ///< set from pthread_self();
    7475    const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
    7576    const unsigned int lineno;         ///< set from __LINE__ in e.g. p_psAlloc
     77    const char *func;                  ///< set from __func__
    7678    psReferenceCount refCounter;       ///< how many times pointer is referenced
    7779    bool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
     
    137139psPtr p_psAlloc(
    138140    size_t size,                       ///< Size required
    139     const char *filename,              ///< File of call
    140     unsigned int lineno                ///< Line number of call
     141    const char *filename,              ///< File of caller
     142    unsigned int lineno,               ///< Line number of caller
     143    const char *func                   ///< Function name of caller
    141144);
    142145
    143146/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
    144147#ifndef SWIG
    145 #define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
     148#define psAlloc(size) \
     149p_psAlloc(size, __FILE__, __LINE__, __func__)
    146150#endif // ! SWIG
    147151
     
    256260    psPtr ptr,                         ///< Pointer to re-allocate
    257261    size_t size,                       ///< Size required
    258     const char *filename,              ///< File of call
    259     unsigned int lineno                ///< Line number of call
     262    const char *filename,              ///< File of caller
     263    unsigned int lineno,               ///< Line number of caller
     264    const char *func                   ///< Function name of caller
    260265);
    261266
    262267/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
    263268#ifndef SWIG
    264 #define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
     269#define psRealloc(ptr, size) \
     270p_psRealloc(ptr, size, __FILE__, __LINE__, __func__)
    265271#endif // ! SWIG
    266272
     
    276282);
    277283#else // #ifdef DOXYGEN
    278 void p_psFree(
    279     psPtr ptr,                         ///< Pointer to free
    280     const char *filename,              ///< File of call
    281     unsigned int lineno                ///< Line number of call
    282 );
    283284
    284285/// Free memory.  psFree sends file and line number to p_psFree.
    285286#ifndef SWIG
    286 //#define psFree(ptr) { p_psFree((psPtr)ptr, __FILE__, __LINE__); *(void**)&(ptr) = NULL; }
    287 #define psFree(ptr) { p_psFree((psPtr)ptr, __FILE__, __LINE__); }
     287//#define psFree(ptr) { p_psMemDecrRefCounter((psPtr)ptr, __FILE__, __LINE__); *(void**)&(ptr) = NULL; }
     288#define psFree(ptr) { p_psMemDecrRefCounter((psPtr)ptr, __FILE__, __LINE__); }
    288289#endif // ! SWIG
    289290
     
    379380#endif // !DOXYGEN
    380381
     382#if 0 // psMemSetRefCounter
    381383/** Set reference counter and return the pointer
    382384 *
     
    404406
    405407#endif // !DOXYGEN
     408#endif // psMemSetRefCounter
    406409
    407410/** Set callback for problems.
Note: See TracChangeset for help on using the changeset viewer.