You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Olivier Mengué <om...@oxymel.com> on 2010/01/21 15:50:38 UTC
RE : How to free axutil environment?
I've removed the axutil_env_free_masked() call, but I still have a leak.
Here is the full Insure++ report:
MEMORY LEAK SUMMARY
===================
2 outstanding memory references for 140 bytes.
Outstanding allocated memory
----------------------------
128 bytes 1 chunk allocated in pth_spinlock.c
malloc() (interface)
_lib_spinlock_create() ../../../../../../../../src/bos/usr/ccs/lib/libpthreads/pth_spinlock.c
_rec_mutex_init_19_13() ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
_rec_mutex_alloc() ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
_findiop() ../../../../../../../src/bos/usr/ccs/lib/libc/findiop.c
sbcra() ../../../../../../../src/bos/usr/ccs/lib/libc/fopen.c
fopen() (interface)
axutil_file_handler_open() file_handler.c
axutil_log_create() log.c
axutil_env_create_all() env.c
main() env_leak.c
12 bytes 1 chunk allocated in rec_mutex.c
malloc() (interface)
_rec_mutex_alloc() ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
_findiop() ../../../../../../../src/bos/usr/ccs/lib/libc/findiop.c
sbcra() ../../../../../../../src/bos/usr/ccs/lib/libc/fopen.c
fopen() (interface)
axutil_file_handler_open() file_handler.c
axutil_log_create() log.c
axutil_env_create_all() env.c
main() env_leak.c
-------- Message d'origine--------
De: Nandika Jayawardana [mailto:jayawark@gmail.com]
Date: jeu. 21/01/2010 05 h 58
À: Apache AXIS C User List
Objet : Re: How to free axutil environment?
You do not need to use axutil_env_free_masked method. calling
axutil_env_free should free up the environment.
Regarda
Nandika
2010/1/20 Olivier Mengué <om...@oxymel.com>
> Hi,
>
> I'm discovering Axis2/C and I try to write a simple program that does not
> leak memory. Without success :(
>
> What is the proper way to free an environment created with
> axutil_env_create_all() ?
>
>
> Here is a sample code that, according to Insure++, leaks 2 blocks of
> memory:
>
> #include <axis2_util.h>
>
> int main(int argc, char *argv[])
> {
> const axutil_env_t *env = NULL;
>
> env = axutil_env_create_all("env_leak.log", AXIS2_LOG_LEVEL_TRACE);
> axutil_env_free_masked((axutil_env_t *) env,
> AXIS_ENV_FREE_LOG|AXIS_ENV_FREE_ERROR|AXIS_ENV_FREE_THREADPOOL);
> axutil_env_free((axutil_env_t *) env);
> return 0;
> }
>
>
> Is there any general documentation about how to manage Axis2/C memory? The
> doxygen documentation is quite light, and it lacks links to free() function
> from the ones that allocate memory.
>
>
>
> Olivier Mengué
>
--
http://nandikajayawardana.blogspot.com/
WSO2 Inc: http://www.wso2.com
RE : RE : How to free axutil environment?
Posted by Olivier Mengué <om...@oxymel.com>.
Thanks for the investigation. I came up to the same conclusion as Insure++ reports the same bogus leak for the following simple program:
#include <stdio.h>
int main(int argc, char *argv[])
{
fclose(fopen(argv[0], "r"));
return 0;
}
I am now filtering this leak report.
Olivier.
-------- Message d'origine--------
De: Damitha Kumarage [mailto:damitha@wso2.com]
Date: ven. 22/01/2010 05 h 12
À: Apache AXIS C User List
Objet : Re: RE : How to free axutil environment?
Olivier Mengué wrote:
>
> The problem seems to be that axutil_log_free() should call
> axutil_file_handler_close(), isn't it ?
>
No axutil_file_handler_close is called from axutil_log_impl_free() which
is the function actully called when environment is freed.
BTW latest valgrind does not show any memory leaks here.
Thanks,
Damitha
Re: RE : How to free axutil environment?
Posted by Damitha Kumarage <da...@wso2.com>.
Olivier Mengué wrote:
>
> The problem seems to be that axutil_log_free() should call
> axutil_file_handler_close(), isn't it ?
>
No axutil_file_handler_close is called from axutil_log_impl_free() which
is the function actully called when environment is freed.
BTW latest valgrind does not show any memory leaks here.
Thanks,
Damitha
>
>
> -------- Message d'origine--------
> De: Olivier Mengué [mailto:omengue@oxymel.com]
>
> I've removed the axutil_env_free_masked() call, but I still have a leak.
>
> Here is the full Insure++ report:
>
> MEMORY LEAK SUMMARY
> ===================
>
> 2 outstanding memory references for 140 bytes.
>
> Outstanding allocated memory
> ----------------------------
> 128 bytes 1 chunk allocated in pth_spinlock.c
> malloc() (interface)
> _lib_spinlock_create()
> ../../../../../../../../src/bos/usr/ccs/lib/libpthreads/pth_spinlock.c
> _rec_mutex_init_19_13()
> ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
> _rec_mutex_alloc()
> ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
> _findiop()
> ../../../../../../../src/bos/usr/ccs/lib/libc/findiop.c
> sbcra()
> ../../../../../../../src/bos/usr/ccs/lib/libc/fopen.c
> fopen() (interface)
> axutil_file_handler_open() file_handler.c
> axutil_log_create() log.c
> axutil_env_create_all() env.c
> main() env_leak.c
>
> 12 bytes 1 chunk allocated in rec_mutex.c
> malloc() (interface)
> _rec_mutex_alloc()
> ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
> _findiop()
> ../../../../../../../src/bos/usr/ccs/lib/libc/findiop.c
> sbcra()
> ../../../../../../../src/bos/usr/ccs/lib/libc/fopen.c
> fopen() (interface)
> axutil_file_handler_open() file_handler.c
> axutil_log_create() log.c
> axutil_env_create_all() env.c
> main() env_leak.c
>
--
__________________________________________________________________
Damitha Kumarage
Technical Lead; WSO2 Inc.
"Oxygenating the Web Service Platform; " http://www.wso2.com/
blog: " http://damithakumarage.wordpress.com/
__________________________________________________________________
RE : How to free axutil environment?
Posted by Olivier Mengué <om...@oxymel.com>.
The problem seems to be that axutil_log_free() should call axutil_file_handler_close(), isn't it ?
-------- Message d'origine--------
De: Olivier Mengué [mailto:omengue@oxymel.com]
I've removed the axutil_env_free_masked() call, but I still have a leak.
Here is the full Insure++ report:
MEMORY LEAK SUMMARY
===================
2 outstanding memory references for 140 bytes.
Outstanding allocated memory
----------------------------
128 bytes 1 chunk allocated in pth_spinlock.c
malloc() (interface)
_lib_spinlock_create() ../../../../../../../../src/bos/usr/ccs/lib/libpthreads/pth_spinlock.c
_rec_mutex_init_19_13() ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
_rec_mutex_alloc() ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
_findiop() ../../../../../../../src/bos/usr/ccs/lib/libc/findiop.c
sbcra() ../../../../../../../src/bos/usr/ccs/lib/libc/fopen.c
fopen() (interface)
axutil_file_handler_open() file_handler.c
axutil_log_create() log.c
axutil_env_create_all() env.c
main() env_leak.c
12 bytes 1 chunk allocated in rec_mutex.c
malloc() (interface)
_rec_mutex_alloc() ../../../../../../../src/bos/usr/ccs/lib/libc/rec_mutex.c
_findiop() ../../../../../../../src/bos/usr/ccs/lib/libc/findiop.c
sbcra() ../../../../../../../src/bos/usr/ccs/lib/libc/fopen.c
fopen() (interface)
axutil_file_handler_open() file_handler.c
axutil_log_create() log.c
axutil_env_create_all() env.c
main() env_leak.c