Index: /branches/jch-memory/psLib/src/sys/psMemory.c
===================================================================
--- /branches/jch-memory/psLib/src/sys/psMemory.c	(revision 10883)
+++ /branches/jch-memory/psLib/src/sys/psMemory.c	(revision 10884)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.88 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-12-08 11:35:54 $
+*  @version $Revision: 1.88.2.1 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-01-03 03:36:38 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -51,18 +51,4 @@
 static bool memory_is_persistent = false;
 
-#ifdef PS_MEM_USE_RECYCLE               // Only use recycling if this is set
-#define N_RECYCLE_BINS 14               // number of recycle bins
-#define MAX_RECYCLE 100                 // Maximum number permitted in a recycle bin
-static pthread_mutex_t recycleMemBlockListMutex = PTHREAD_MUTEX_INITIALIZER; // Mutex for recycle bins
-static const psS32 recycleBinSize[N_RECYCLE_BINS] = // Size of each bin
-    {
-        8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
-    };
-// N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
-static psS32 recycleBinNums[N_RECYCLE_BINS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Number in each bin
-static psMemBlock* recycleMemBlockList[N_RECYCLE_BINS] = // Contents of the bins
-    { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
-#endif // #ifdef PS_MEM_USE_RECYCLE
-
 #ifdef PS_MEM_DEBUG
 static psMemBlock* deadBlockList;       // a place to put dead memBlocks in debug mode.
@@ -79,30 +65,5 @@
 static psPtr memExhaustedCallbackDefault(size_t size)
 {
-    #if PS_MEM_USE_RECYCLE
-    psPtr ptr = NULL;
-    if (safeThreads) {
-        pthread_mutex_lock(&recycleMemBlockListMutex);
-    }
-    // Attempt to free up everything I can find so I can alloc my ptr
-    int bin = N_RECYCLE_BINS - 1;       // Recycle bin
-
-    while (bin >= 0 && ptr == NULL) {
-        while (recycleMemBlockList[bin] != NULL && ptr == NULL) {
-            psMemBlock *old = recycleMemBlockList[bin];
-            recycleMemBlockList[bin] = recycleMemBlockList[bin]->nextBlock;
-            free(old);
-            ptr = malloc(size);
-        }
-        bin--;
-    }
-
-    if (safeThreads) {
-        pthread_mutex_unlock(&recycleMemBlockListMutex);
-    }
-    return ptr;
-    #else  // #ifdef PS_MEM_USE_RECYCLE
-
     return NULL;
-    #endif // #ifdef PS_MEM_USE_RECYCLE
 }
 
@@ -364,77 +325,4 @@
 }
 
-#ifdef PS_MEM_USE_RECYCLE
-// Return the appropriate recycle bin number
-static int getRecycleBin(size_t size)
-{
-    if (size >= P_PS_LARGE_BLOCK_SIZE) {
-        return N_RECYCLE_BINS;
-    }
-    int binNum = 0;                     // Recycle bin number
-    while (size > recycleBinSize[binNum]) {
-        binNum++;
-    }
-    return binNum;
-}
-
-// Push a pointer onto the recycle bin
-static void recyclePush(psMemBlock *mb, // Pointer to push
-                        int bin         // Recycling bin
-                       )
-{
-    assert(mb);
-    assert(bin < N_RECYCLE_BINS);
-
-    mb->previousBlock = NULL;
-
-    if (safeThreads) {
-        pthread_mutex_lock(&recycleMemBlockListMutex);
-    }
-
-    mb->nextBlock = recycleMemBlockList[bin];
-    if (recycleMemBlockList[bin] != NULL) {
-        recycleMemBlockList[bin]->previousBlock = mb;
-    }
-    recycleMemBlockList[bin] = mb;
-    recycleBinNums[bin]++;
-
-    if (safeThreads) {
-        pthread_mutex_unlock(&recycleMemBlockListMutex);
-    }
-
-    return;
-}
-
-// Pop a pointer from the recycle bin
-static psMemBlock *recyclePop(int bin   // Recycling bin
-                             )
-{
-    if (bin >= N_RECYCLE_BINS) {
-        return NULL;
-    }
-
-    if (safeThreads) {
-        pthread_mutex_lock(&recycleMemBlockListMutex);
-    }
-
-    psMemBlock *mb = recycleMemBlockList[bin]; // Pointer popped from recycle bin
-
-    if (mb) {
-        // We pull it off the list
-        recycleMemBlockList[bin] = mb->nextBlock;
-        if (recycleMemBlockList[bin] != NULL) {
-            recycleMemBlockList[bin]->previousBlock = NULL;
-        }
-        recycleBinNums[bin]--;
-    }
-
-    if (safeThreads) {
-        pthread_mutex_unlock(&recycleMemBlockListMutex);
-    }
-
-    return mb;
-}
-#endif // #ifdef PS_MEM_USE_RECYCLE
-
 /*
  * Actually allocate memory
@@ -446,13 +334,4 @@
 
     psMemBlock *ptr = NULL;
-
-    #ifdef PS_MEM_USE_RECYCLE
-    // Are we in one of the recycle bins?
-    int bin = getRecycleBin(size);
-    if (bin < N_RECYCLE_BINS) {
-        size = recycleBinSize[bin];     // round-up size to next sized bin.
-        ptr = recyclePop(bin);          // grab out of the recycle bin
-    }
-    #endif // #ifdef PS_MEM_USE_RECYCLE
 
     if (ptr == NULL) {
@@ -531,12 +410,4 @@
     }
 
-    #ifdef PS_MEM_USE_RECYCLE
-    // Ensure the size matches that of the recycle bin
-    int bin = getRecycleBin(size);
-    if (bin < N_RECYCLE_BINS) {
-        size = recycleBinSize[bin];     // round-up size to next sized bin.
-    }
-    #endif // #ifdef PS_MEM_USE_RECYCLE
-
     if (size == ptr->userMemorySize) {
         // Nothing to do
@@ -831,32 +702,4 @@
         if (safeThreads) {
             pthread_mutex_unlock(&memBlockListMutex);
-        }
-
-        #ifdef PS_MEM_USE_RECYCLE
-        // do we recycle?
-        int bin = getRecycleBin(ptr->userMemorySize);
-        if (bin < N_RECYCLE_BINS && recycleBinNums[bin] < MAX_RECYCLE) {
-            ptr->refCounter = 0;
-            recyclePush(ptr, bin);
-        } else
-            #endif  // #ifdef PS_MEM_USE_RECYCLE
-            {
-                // memory is larger than I want to recycle.
-                #ifdef PS_MEM_DEBUG
-                (void)p_psRealloc(vptr, 0, file, lineno);
-                ptr->previousBlock = NULL;
-                ptr->nextBlock = deadBlockList;
-                if (deadBlockList != NULL) {
-                deadBlockList->previous = ptr;
-            }
-        deadBlockList = ptr;
-        #else // #ifdef PS_MEM_DEBUG
-
-        if (safeThreads) {
-            pthread_mutex_destroy(&ptr->refCounterMutex);
-            }
-            free(ptr);
-            #endif // #else - #ifdef PS_MEM_DEBUG
-
         }
 
@@ -1221,6 +1064,5 @@
 size_t psMemStats(const bool print, // print details as they're found?
                   size_t *allocated, // memory that's currently allocated (but not persistent)
-                  size_t *persistent, // persistent memory that's currently allocated
-                  size_t *freelist) // memory that's waiting to be recycled
+                  size_t *persistent) // persistent memory that's currently allocated
 {
     const size_t overhead = sizeof(psMemBlock) + sizeof(psPtr); // overhead on each allocation
@@ -1264,36 +1106,4 @@
         printf("Persistent %6s  %10zd %8zd\n", "", persist, npersist);
     }
-    /*
-     * Count the memory on the free list
-     */
-    size_t freelist_s;
-    if (freelist == NULL) {
-        freelist = &freelist_s;
-    }
-
-    *freelist = 0;
-    int nblock_tot = 0;
-    #ifdef PS_MEM_USE_RECYCLE
-
-    for (int i = 0; recycleBinSize[i] < P_PS_LARGE_BLOCK_SIZE; i++) {
-        size_t bin_contents = 0;
-        size_t nblock = 0;
-        for (const psMemBlock *ptr = recycleMemBlockList[i]; ptr != NULL; ptr = ptr->nextBlock) {
-            nblock++;
-            bin_contents += ptr->userMemorySize + overhead;
-        }
-        *freelist += bin_contents;
-        nblock_tot += nblock;
-
-        if (print) {
-            printf("Freelist   %6d  %10d %8d\n", recycleBinSize[i], bin_contents, nblock);
-        }
-    }
-    #endif // #ifdef PS_MEM_USE_RECYCLE
-
-    if (print) {
-        printf("Freelist   %6s  %10zd %8d\n", "", *freelist, nblock_tot);
-    }
-
 
     if (safeThreads) {
@@ -1301,4 +1111,4 @@
     }
 
-    return *freelist + *allocated + *persistent;
-}
+    return *allocated + *persistent;
+}
Index: /branches/jch-memory/psLib/src/sys/psMemory.h
===================================================================
--- /branches/jch-memory/psLib/src/sys/psMemory.h	(revision 10883)
+++ /branches/jch-memory/psLib/src/sys/psMemory.h	(revision 10884)
@@ -12,6 +12,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-10-13 21:13:48 $
+ *  @version $Revision: 1.61.2.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-01-03 03:36:38 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -522,11 +522,10 @@
 /** return statistics on memory usage
  *
- * @return the total amount of memory owned by psLib; if non-NULL also provide a breakdown
- * into recyclable, allocated, and allocated-and-persistent
+ * @return the total amount of memory owned by psLib; if non-NULL also provide
+ * a breakdown into allocated and allocated-and-persistent
  */
 size_t psMemStats(const bool print, ///< print details as they're found?
                   size_t *allocated, ///< memory that's currently allocated (but not persistent)
-                  size_t *persistent, ///< persistent memory that's currently allocated
-                  size_t *freelist); ///< memory that's waiting to be recycled
+                  size_t *persistent); ///< persistent memory that's currently allocated
 
 //@} End of Memory Management Functions
