Bill Stoddard wrote:
@@ -1340,7 +1343,7 @@
/* Run cleanups */
run_cleanups(&pool->cleanups);
- pool->cleanups = NULL;
+ pool->free_cleanups = pool->cleanups = NULL;
/* If new child pools showed up, this is a reason to raise a flag */
if (pool->child)
@@ -1886,7 +1889,13 @@
#endif /* APR_POOL_DEBUG */
if (p != NULL) {
- c = (cleanup_t *)apr_palloc(p, sizeof(cleanup_t));
+ if (p->free_cleanups) {
+ /* reuse a cleanup structure */
+ c = p->free_cleanups;
+ p->free_cleanups = c->next;
+ } else {
+ c = (cleanup_t *)apr_palloc(p, sizeof(cleanup_t));
+ }
c->data = data;
c->plain_cleanup_fn = plain_cleanup_fn;
c->child_cleanup_fn = child_cleanup_fn;
c->next = NULL; ????
Nevermind...
Bill