You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2011/04/01 07:54:14 UTC

Re: svn commit: r1087333 - /httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c


On 03/31/2011 05:12 PM, jim@apache.org wrote:
> Author: jim
> Date: Thu Mar 31 15:12:13 2011
> New Revision: 1087333
> 
> URL: http://svn.apache.org/viewvc?rev=1087333&view=rev
> Log:
> Don't kill me mister...

Why? Don't we create a memory leak if we even do not clean the pools?
What was wrong with destroying the pool?

> 
> Modified:
>     httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
> 
> Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c?rev=1087333&r1=1087332&r2=1087333&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c (original)
> +++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c Thu Mar 31 15:12:13 2011
> @@ -207,7 +207,6 @@ static apr_status_t cleanup_slotmem(void
>  
>      if (*mem) {
>          ap_slotmem_instance_t *next = *mem;
> -        apr_pool_t *p = next->gpool;
>          while (next) {
>              if (AP_SLOTMEM_IS_PERSIST(next)) {
>                  store_slotmem(next);
> @@ -215,11 +214,6 @@ static apr_status_t cleanup_slotmem(void
>              apr_shm_destroy((apr_shm_t *)next->shm);
>              next = next->next;
>          }
> -        apr_pool_destroy(p);
> -    } else {
> -        /* If shared mem was never called, then just remove
> -         * the global pool */
> -        apr_pool_destroy(gpool);
>      }
>      return APR_SUCCESS;
>  }
> @@ -572,7 +566,7 @@ static apr_status_t slotmem_grab(ap_slot
>          }
>      }
>      if (i >= slot->desc.num) {
> -        return APR_ENOSHMAVAIL;
> +        return APR_EINVAL;
>      }
>      *inuse = 1;
>      *id = i;
> @@ -623,7 +617,9 @@ static const ap_slotmem_provider_t *slot
>  /* initialise the global pool */
>  static void slotmem_shm_initgpool(apr_pool_t *p)
>  {
> -    gpool = p;
> +    if (!gpool && p) {
> +        gpool = p;
> +    }

If we don't use a new pool if we already have one why do we continue to create
new pools in the pre_config hook?


Regards

RĂ¼diger