IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 17, 2006, 1:05:23 PM (20 years ago)
Author:
Paul Price
Message:

We want to avoid using the psString functions, or any function that
calls the PS memory management, since there seems to be a problem with
memory fragmentation. Since psTrace can get called a LOT, it
manifests this problem. To get around this, we will use variable
length char arrays, instead of the psString functions. This can be
revised once the PS memory management system is fixed.

File:
1 edited

Legend:

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

    r8245 r8413  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-09 02:26:44 $
     11 *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-08-17 23:05:23 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3737 
    3838 *****************************************************************************/
     39
     40
     41// NOTE: We want to avoid using the psString functions, or any function that calls the PS memory management,
     42// since there seems to be a problem with memory fragmentation.  Since psTrace can get called a LOT, it
     43// manifests this problem.  To get around this, we will use variable length char arrays, instead of the
     44// psString functions.  This can be revised once the PS memory management system is fixed.
     45#define USE_PS_MEMORY 0
     46
    3947
    4048#ifndef PS_NO_TRACE
     
    385393int psTraceGetLevel(const char *name)
    386394{
    387     char *compName = NULL;
    388395    psS32 traceLevel;
    389396
     
    394401    // If the component name has no leading dot, then supply it.
    395402    if (name[0] != '.') {
    396         compName = (char *) psAlloc(10 + strlen(name));
     403        #if USE_PS_MEMORY
     404        psString compName = (char *) psAlloc(10 + strlen(name));
    397405        strcpy(compName, ".");
    398406        compName = strcat(compName, name);
     407        #else
     408
     409        char compName[strlen(name) + 2];
     410        compName[0] = '.';
     411        strcpy(&compName[1], name);
     412        #endif
     413
    399414        traceLevel = doGetTraceLevel(compName);
     415        #if USE_PS_MEMORY
     416
    400417        psFree(compName);
     418        #endif
     419
    401420    } else {
    402421        // Search the component root tree, determine the trace level.
     
    629648    va_start(ap, format);
    630649    //    format = va_arg(ap, char *);
     650
     651    #if USE_PS_MEMORY
     652
    631653    psString fullFacil = NULL;
    632654    psStringAppend(&fullFacil, "%s.%s", facil, func);
     655    #else
     656
     657    size_t facilLength = strlen(facil); // Length of facility name
     658    size_t funcLength = strlen(func);   // Length of function name
     659    char fullFacil[facilLength + funcLength + 2]; // Full facility name is the facility + the function name
     660    strcpy(&fullFacil[0], facil);
     661    fullFacil[facilLength] = '.';
     662    strcpy(&fullFacil[facilLength + 1], func);
     663    #endif
     664
    633665    psTraceV(fullFacil, level, format, ap);
     666    #if USE_PS_MEMORY
     667
    634668    psFree(fullFacil);
     669    #endif
     670
    635671    va_end(ap);
    636672    // fflush(traceFP);
Note: See TracChangeset for help on using the changeset viewer.