diff options
author | Corey Farrell <git@cfware.com> | 2016-10-29 11:19:53 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2016-10-29 11:19:53 -0400 |
commit | ad60927a40cf07bb60225c3613ae92b12aa92101 (patch) | |
tree | 4db0d92c2568f1121f29c4d7531375c5c310e6d9 /main/astobj2.c | |
parent | 0ec5abe59286ed02377c2d7fe25d2e2e9babc58a (diff) |
astobj2: Declare private variable data_size for AO2_DEBUG only.
Every ao2 object contains storage for a private variable data_size,
though the value is never read if AO2_DEBUG is disabled. This change
makes the variable conditional, reducing memory usage.
ASTERISK-26524 #close
Change-Id: If859929e507676ebc58b0f84247a4231e11da07f
Diffstat (limited to 'main/astobj2.c')
-rw-r--r-- | main/astobj2.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/main/astobj2.c b/main/astobj2.c index 114f26045..c8e48bbf5 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -52,8 +52,10 @@ struct __priv_data { ao2_destructor_fn destructor_fn; /*! This field is used for astobj2 and ao2_weakproxy objects to reference each other */ void *weakptr; +#if defined(AO2_DEBUG) /*! User data size for stats */ size_t data_size; +#endif /*! The ao2 object option flags */ uint32_t options; /*! magic number. This is used to verify that a pointer passed in is a @@ -669,11 +671,11 @@ static void *internal_ao2_alloc(size_t data_size, ao2_destructor_fn destructor_f /* Initialize common ao2 values. */ obj->priv_data.ref_counter = 1; obj->priv_data.destructor_fn = destructor_fn; /* can be NULL */ - obj->priv_data.data_size = data_size; obj->priv_data.options = options; obj->priv_data.magic = AO2_MAGIC; #ifdef AO2_DEBUG + obj->priv_data.data_size = data_size; ast_atomic_fetchadd_int(&ao2.total_objects, 1); ast_atomic_fetchadd_int(&ao2.total_mem, data_size); ast_atomic_fetchadd_int(&ao2.total_refs, 1); |