IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11416


Ignore:
Timestamp:
Jan 29, 2007, 5:00:50 PM (19 years ago)
Author:
jhoblitt
Message:

rename psMemCheckCorruption() -> p_psMemCheckCorruption() & add a macro wrapper to pass in the the 3-coords
rename psMemCheckLeaks() -> p_psMemCheckLeaks() & add a macro wrapper to pass in the the 3-coords
change p_psMemCheckLeaks() to invoke p_psMemCheckCorruption() before crawling the block list in an attempt to prevent segfaults

Location:
trunk/psLib/src/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psMemory.c

    r11265 r11416  
    1010*  @author Joshua Hoblitt, University of Hawaii
    1111*
    12 *  @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2007-01-24 22:14:48 $
     12*  @version $Revision: 1.90 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2007-01-30 03:00:50 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    355355}
    356356
    357 int psMemCheckCorruption(FILE *output, bool abort_on_error)
     357int p_psMemCheckCorruption(FILE *output,
     358                           bool abort_on_error,
     359                           const char *file,
     360                           unsigned int lineno,
     361                           const char *func)
    358362{
    359363    // get exclusive access to the memBlock list to avoid it changing on us
     
    561565 * Check for memory leaks.
    562566 */
    563 int psMemCheckLeaks(psMemId id0,
    564                     psMemBlock ***array,
    565                     FILE * fd,
    566                     bool persistence)
     567int p_psMemCheckLeaks(psMemId id0,
     568                      psMemBlock ***array,
     569                      FILE * fd,
     570                      bool persistence,
     571                      const char *file,
     572                      unsigned int lineno,
     573                      const char *func)
    567574{
    568575    psS32 nleak = 0;
    569576    psS32 j = 0;
    570577    psMemBlock *topBlock = lastMemBlockAllocated;
     578
     579    // make sure that the memblock list is free of corruption before we crawl
     580    // the list
     581    p_psMemCheckCorruption(fd, true, file, lineno, func);
    571582
    572583    MUTEX_LOCK(&memBlockListMutex);
  • trunk/psLib/src/sys/psMemory.h

    r11265 r11416  
    1515 *  @ingroup MemoryManagement
    1616 *
    17  *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
    18  *  @date $Date: 2007-01-24 22:14:48 $
     17 *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
     18 *  @date $Date: 2007-01-30 03:00:50 $
    1919 *
    2020 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    391391 *  @see psAlloc, psFree, psgetMemId, psMemProblemCallbackSet
    392392 */
     393#ifdef DOXYGEN
    393394int psMemCheckLeaks(
    394395    psMemId id0,                       ///< don't list blocks with id < id0
     
    397398    bool persistence                   ///< make check across all object even persistent ones
    398399);
     400#else // ifdef DOXYGEN
     401int p_psMemCheckLeaks(
     402    psMemId id0,                       ///< don't list blocks with id < id0
     403    psMemBlock ***array,               ///< pointer to array of pointers to leaked blocks, or NULL
     404    FILE * fd,                         ///< print list of leaks to fd (or NULL)
     405    bool persistence,                  ///< make check across all object even persistent ones
     406    const char *file,                   ///< File of caller
     407    unsigned int lineno,                ///< Line number of caller
     408    const char *func                    ///< Function name of caller
     409);
     410#ifndef SWIG
     411#define psMemCheckLeaks(id0, array, fd, persistence) \
     412p_psMemCheckLeaks(id0, array, fd, persistence, __FILE__, __LINE__, __func__)
     413#endif // ifndef SWIG
     414#endif // ifdef DOXYGEN
     415
    399416
    400417/** Check for memory corruption.  Scans all currently allocated memory buffers and checks for corruptions,
     
    404421 *
    405422 */
     423#ifdef DOXYGEN
    406424int psMemCheckCorruption(
    407425    FILE *output,                       ///< FILE to write corrupted blocks too
    408426    bool abort_on_error                 ///< Abort on detecting corruption?
    409427);
     428#else // ifdef DOXYGEN
     429int p_psMemCheckCorruption(
     430    FILE *output,                       ///< FILE to write corrupted blocks too
     431    bool abort_on_error,                ///< Abort on detecting corruption?
     432    const char *file,                   ///< File of caller
     433    unsigned int lineno,                ///< Line number of caller
     434    const char *func                    ///< Function name of caller
     435);
     436#ifndef SWIG
     437#define psMemCheckCorruption(output, abort_on_error) \
     438p_psMemCheckCorruption(output, abort_on_error, __FILE__, __LINE__, __func__)
     439#endif // ifndef SWIG
     440#endif // ifdef DOXYGEN
     441
    410442
    411443/** Return reference counter
Note: See TracChangeset for help on using the changeset viewer.