summaryrefslogtreecommitdiff
path: root/memory
diff options
context:
space:
mode:
authorbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-01-31 19:15:44 +0000
committerbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-01-31 19:15:44 +0000
commit2b2783691263dfcf5586fa96be80b382738a152e (patch)
treee226c721ee9428cfdc0589e36699496466a8110a /memory
parentcd30b9941d3cc9bab96efd48c5918506a8a900f8 (diff)
downloadlibapr-2b2783691263dfcf5586fa96be80b382738a152e.tar.gz
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. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62882 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory')
-rw-r--r--memory/unix/apr_pools.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 76302b298..b318e686b 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -186,6 +186,9 @@ struct apr_pool_t {
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 @@ APR_DECLARE(void) apr_pool_terminate(void)
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 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
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