Index: /trunk/psLib/src/sys/psTrace.c
===================================================================
--- /trunk/psLib/src/sys/psTrace.c	(revision 8412)
+++ /trunk/psLib/src/sys/psTrace.c	(revision 8413)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-08-09 02:26:44 $
+ *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-08-17 23:05:23 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -37,4 +37,12 @@
  
  *****************************************************************************/
+
+
+// NOTE: 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.
+#define USE_PS_MEMORY 0
+
 
 #ifndef PS_NO_TRACE
@@ -385,5 +393,4 @@
 int psTraceGetLevel(const char *name)
 {
-    char *compName = NULL;
     psS32 traceLevel;
 
@@ -394,9 +401,21 @@
     // If the component name has no leading dot, then supply it.
     if (name[0] != '.') {
-        compName = (char *) psAlloc(10 + strlen(name));
+        #if USE_PS_MEMORY
+        psString compName = (char *) psAlloc(10 + strlen(name));
         strcpy(compName, ".");
         compName = strcat(compName, name);
+        #else
+
+        char compName[strlen(name) + 2];
+        compName[0] = '.';
+        strcpy(&compName[1], name);
+        #endif
+
         traceLevel = doGetTraceLevel(compName);
+        #if USE_PS_MEMORY
+
         psFree(compName);
+        #endif
+
     } else {
         // Search the component root tree, determine the trace level.
@@ -629,8 +648,25 @@
     va_start(ap, format);
     //    format = va_arg(ap, char *);
+
+    #if USE_PS_MEMORY
+
     psString fullFacil = NULL;
     psStringAppend(&fullFacil, "%s.%s", facil, func);
+    #else
+
+    size_t facilLength = strlen(facil); // Length of facility name
+    size_t funcLength = strlen(func);   // Length of function name
+    char fullFacil[facilLength + funcLength + 2]; // Full facility name is the facility + the function name
+    strcpy(&fullFacil[0], facil);
+    fullFacil[facilLength] = '.';
+    strcpy(&fullFacil[facilLength + 1], func);
+    #endif
+
     psTraceV(fullFacil, level, format, ap);
+    #if USE_PS_MEMORY
+
     psFree(fullFacil);
+    #endif
+
     va_end(ap);
     // fflush(traceFP);
