apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apr/memory/unix apr_pools.c
Date Thu, 31 Jan 2002 19:15:44 GMT
bnicholes    02/01/31 11:15:44

  Modified:    memory/unix apr_pools.c
  Log:
  All memory resources are shared with all NLMs running on NetWare.  This
  requires us to have to track each applications use of memory and make sure
  that the memory is freed back to the global pool when the application
  terminates.  Added code to help track which application owns each pool and
  a cleanup routine for making sure that all memory is freed when the application
  terminates.  Also redefined the malloc() call for NetWare to library_malloc() so
  that the library actually owns all memory allocated and can distribute it how it
  sees fit.  This prevents an application from terminating and invalidating half
  of the memory in the global memory pool.
  
  Revision  Changes    Path
  1.147     +24 -0     apr/memory/unix/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- apr_pools.c	30 Jan 2002 13:10:16 -0000	1.146
  +++ apr_pools.c	31 Jan 2002 19:15:44 -0000	1.147
  @@ -186,6 +186,9 @@
       apr_thread_mutex_t   *mutex;
   #endif /* APR_HAS_THREADS */
   #endif /* APR_POOL_DEBUG */
  +#ifdef NETWARE
  +    apr_os_proc_t         owner_proc;
  +#endif
   };
   
   #define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  @@ -266,6 +269,24 @@
       memset(&global_allocator, 0, SIZEOF_ALLOCATOR_T);
   }
   
  +#ifdef NETWARE
  +void netware_pool_proc_cleanup ()
  +{
  +    apr_pool_t *pool = global_pool->child;
  +    apr_os_proc_t owner_proc = (apr_os_proc_t)getnlmhandle();
  +
  +    while (pool) {
  +        if (pool->owner_proc == owner_proc) {
  +            apr_pool_destroy (pool);
  +            pool = global_pool->child;
  +        }
  +        else {
  +            pool = pool->sibling;
  +        }
  +    }
  +    return;
  +}
  +#endif
   
   /*
    * Memory allocation
  @@ -707,6 +728,9 @@
           pool->user_data = NULL;
           pool->tag = NULL;
       }
  +#ifdef NETWARE
  +    pool->owner_proc = (apr_os_proc_t)getnlmhandle();
  +#endif
   
       if ((pool->parent = parent) != NULL) {
   #if APR_HAS_THREADS
  
  
  

Mime
View raw message