apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Laplante <lapla...@sednove.ca>
Subject apr_allocator_max_free_set
Date Fri, 18 Aug 2006 20:25:44 GMT
I used the following codes to set back the memory usage of a httpd 
process using apr for pool allocation. The value of freealloc
can vbe adjust using configuration directive in httpd.conf.

If I put 1024, and allocate 500 Mb, the memory is release
If I put 8192, the memory is never release.

Do you know what is the problem,

 apr_allocator_t* pa = apr_pool_allocator_get(r->pool);
  if (pa) {
    SNDEBUGS(r->server, "freealloc = %d", conf -> freealloc);
    if (conf -> freealloc != 0)
      apr_allocator_max_free_set(pa, conf -> freealloc);
    else
      apr_allocator_max_free_set(pa, 2048);


The following code allocate the memory:

apr_pool_t *mypool;
    apr_status_t res = apr_pool_create(&mypool,  r->pool);
   
    SNDEBUGS(r->server, "maxi=%d, maxj=%d", maxi, maxj);
    int nb=0;
    for(j=0;j<maxj;++j) {
      for(i=0;i<maxi;++i) {
      char *fulltmpdir = apr_palloc(mypool,1000);
      nb += 1000;
      }
    }

    SNDEBUGS(r -> server, "wait 10 secondes allocation=%d Mb\n", 
nb/1024/1024);
    sleep(10);
    apr_pool_destroy(mypool);

thanks


Mime
View raw message