[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: Memory Consumption...

From: Sander Striker <striker_at_apache.org>
Date: 2002-02-03 02:17:02 CET

Given the reports about high memory usage, a small
patch (bandaid). I'll be looking into a more permanent
solution tomorrow and upcomming week.

Sander

Index: memory/unix/apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.147
diff -u -r1.147 apr_pools.c
--- memory/unix/apr_pools.c 31 Jan 2002 19:15:44 -0000 1.147
+++ memory/unix/apr_pools.c 3 Feb 2002 01:11:09 -0000
@@ -371,7 +371,7 @@
     /* If we found nothing, seek the sink (at index 0), if
      * it is not empty.
      */
- else if (allocator->free[0]) {
+ else if (index >= MAX_INDEX && allocator->free[0] != NULL) {
 #if APR_HAS_THREADS
         if (allocator->mutex)
             apr_thread_mutex_lock(allocator->mutex);
@@ -418,7 +418,7 @@

 static APR_INLINE void node_free(allocator_t *allocator, node_t *node)
 {
- node_t *next;
+ node_t *next, *free_nodes = NULL;
     apr_uint32_t index, max_index;

 #if APR_HAS_THREADS
@@ -448,8 +448,13 @@
             /* This node is too large to keep in a specific size bucket,
              * just add it to the sink (at index 0).
              */
+#if 0
             node->next = allocator->free[0];
             allocator->free[0] = node;
+#endif
+
+ node->next = free_nodes;
+ free_nodes = node;
         }
     }
     while ((node = next) != NULL);
@@ -460,6 +465,11 @@
     if (allocator->mutex)
         apr_thread_mutex_unlock(allocator->mutex);
 #endif
+
+ while ((node = free_nodes) != NULL) {
+ free_nodes = node->next;
+ free(node);
+ }
 }

 APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:03 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.