Skip to content

Commit 6df2b8e

Browse files
committed
Fix pool debugging output so that creation events are
always emitted before allocation events and subpool destruction events are emitted on pool clear/destroy for proper accounting. Backport of r1675967 from trunk resp. r1863202 from 1.7.x. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1863211 13f79535-47bb-0310-9956-ffa450edef68
1 parent 83fa66b commit 6df2b8e

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
-*- coding: utf-8 -*-
22
Changes for APR 1.6.6
33

4+
*) apr_pools: Fix pool debugging output so that creation events are
5+
always emitted before allocation events and subpool destruction
6+
events are emitted on pool clear/destroy for proper accounting.
7+
[Brane Čibej]
48

59

610
Changes for APR 1.6.5

memory/unix/apr_pools.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,10 +1886,6 @@ APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool,
18861886

18871887
apr_pool_check_lifetime(pool);
18881888

1889-
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
1890-
apr_pool_log_event(pool, "CLEAR", file_line, 1);
1891-
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
1892-
18931889
#if APR_HAS_THREADS
18941890
if (pool->parent != NULL)
18951891
mutex = pool->parent->mutex;
@@ -1905,6 +1901,10 @@ APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool,
19051901

19061902
pool_clear_debug(pool, file_line);
19071903

1904+
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
1905+
apr_pool_log_event(pool, "CLEAR", file_line, 1);
1906+
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
1907+
19081908
#if APR_HAS_THREADS
19091909
/* If we had our own mutex, it will have been destroyed by
19101910
* the registered cleanups. Recreate the mutex. Unlock
@@ -1929,12 +1929,12 @@ static void pool_destroy_debug(apr_pool_t *pool, const char *file_line)
19291929
{
19301930
apr_pool_check_lifetime(pool);
19311931

1932+
pool_clear_debug(pool, file_line);
1933+
19321934
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
19331935
apr_pool_log_event(pool, "DESTROY", file_line, 1);
19341936
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
19351937

1936-
pool_clear_debug(pool, file_line);
1937-
19381938
/* Remove the pool from the parents child list */
19391939
if (pool->parent) {
19401940
#if APR_HAS_THREADS
@@ -2043,6 +2043,9 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
20432043
pool->owner_proc = (apr_os_proc_t)getnlmhandle();
20442044
#endif /* defined(NETWARE) */
20452045

2046+
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
2047+
apr_pool_log_event(pool, "CREATE", file_line, 1);
2048+
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
20462049

20472050
if (parent == NULL || parent->allocator != allocator) {
20482051
#if APR_HAS_THREADS
@@ -2072,10 +2075,6 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
20722075

20732076
*newpool = pool;
20742077

2075-
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
2076-
apr_pool_log_event(pool, "CREATE", file_line, 1);
2077-
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
2078-
20792078
return APR_SUCCESS;
20802079
}
20812080

@@ -2129,6 +2128,10 @@ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpoo
21292128
}
21302129
pool->allocator = pool_allocator;
21312130

2131+
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
2132+
apr_pool_log_event(pool, "CREATEU", file_line, 1);
2133+
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
2134+
21322135
if (pool->allocator != allocator) {
21332136
#if APR_HAS_THREADS
21342137
apr_status_t rv;
@@ -2151,10 +2154,6 @@ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpoo
21512154

21522155
*newpool = pool;
21532156

2154-
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
2155-
apr_pool_log_event(pool, "CREATEU", file_line, 1);
2156-
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
2157-
21582157
return APR_SUCCESS;
21592158
}
21602159

0 commit comments

Comments
 (0)