Hi, 

> Checking my module with a stress test (1440 reqs/min) I'm observing , 
> with top, that SIZE and RSS of httpd processes are growing.

I recommend you to check apr_allocator_max_free_set().

The following sample code shows the effect.
Without calling apr_allocator_max_free_set(), you can find the memory usage is 
growing rapidly.


///////////////// sample code starts
/* memory pool leak test.
 * @remark No error checks */
#include <stdio.h>
#include <apr_general.h>

int main(int argc, char **argv)
{
    apr_pool_t *mp;
    int i;
        
    apr_initialize();
    apr_pool_create(&mp, NULL);

    /* XXX Without this setting, memory usage is growing more than expected */
#define MY_POOL_MAX_FREE_SIZE   32
    {
        apr_allocator_t *pa = apr_pool_allocator_get(mp);
        if (pa) {
            apr_allocator_max_free_set(pa, MY_POOL_MAX_FREE_SIZE);
        }
    }

#define BASE_ALLOC_SIZE    (8*1024)
    i = 0;
    while (1) {
        apr_palloc(mp, BASE_ALLOC_SIZE + i);
        i++;
        if (i % 10000 == 0) {
            puts("press enter key (please check memory usage)");
            getchar();
        }
        apr_pool_clear(mp);
    }
    apr_terminate();
    return 0;
}
///////////////// sample code ends


- INOUE Seiichiro <[EMAIL PROTECTED]>

Reply via email to