Hello list, first I want to thank the developers for the great work they are doing in creating and maintaining the sofia library.
But now to my problem: I'm writing a SIP client application to run on an ARM platform and I'm having serious problems with a memory leak in the sofia library. It seems the memory allocated with nua_handle() is not freed if nua_handle_destroy is called. To demonstrate the problem, I appended the source code of a mini sofia program which allocates a bunch of nua_handles, and after that destroys them, but the memory is never freed (on ARM). On x86 the memory is freed, but sometimes not immediately; sometimes it takes a couple of minutes until the memory usage of the process gets back to normal (can anybody explain this?). But on ARM the memory usage doesn't go back to normal, even after hours the memory is not released. I'v configured the sofia-library for arm using: ./configure --host=arm --without-openssl --without-glib --prefix=/home/fsminimal/usr/local where /home/fsminimal is my ARM root directory. I'm linking the static library. I had to undefine HAVE_CLOCK_GETTIME in the source, since CLOCK_MONOTONIC is not supported on my ARM system. For comparison I even undefined HAVE_CLOCK_GETTIME for the x86 platform but it didn't have any negative effect there. Besides this, sofia is working as it should, but the memory consumption of my application is steadily increasing (during a load test), until the process is killed by the OOM . Does anybody have an idea what is causing this? Thank you in advance for your answers, Friedrich //C source start --------------------------------------------------------------- #define SU_ROOT_MAGIC_T struct application_object #define SOA_MAGIC_T struct call_object #define NUA_HMAGIC_T struct call_object #include <sofia-sip/nua.h> #include <sofia-sip/su.h> #include "sofia-sip/soa.h" #include "sofia-sip/soa_session.h" #include <assert.h> #include <pthread.h> #include <string.h> #include <ctype.h> #include <stdlib.h> struct application_object{ su_home_t app_home[1]; su_root_t *app_root; nua_t *nua; } app; struct call_object{ int dummy; }; void* run_nua_event_loop() { app.app_root = su_root_create (NULL); app.nua=NULL; su_init(); su_home_init(app.app_home); assert(app.app_root); su_root_run(app.app_root); su_deinit(); su_root_destroy (app.app_root); return NULL; } void nua_event_callback(nua_event_t event,int status, char const *phrase, nua_t *nua, nua_magic_t *magic, nua_handle_t *nh, struct call_object *co, sip_t const *sip, tagi_t tags[]) { fprintf(stderr,"got event %i\n",event); } int main(){ int i,j; pthread_t nua_thread; pthread_create( &nua_thread, NULL, run_nua_event_loop,NULL); sleep(2); app.nua = nua_create(app.app_root,nua_event_callback,&app,NUTAG_URL("sip:0.0.0.0:5060"),TAG_NULL()); #define ARM #ifdef ARM int sz=10000; #else int sz=500000; #endif //allocating room for nua_handles nua_handle_t **nh=malloc(4*sz); assert(nh); fprintf(stderr,"step1 alloc\n"); for(i=0;i<sz;i++){ //creating handles nh[i]=nua_handle(app.nua, NULL,SIPTAG_TO_STR("[EMAIL PROTECTED]"), NUTAG_AUTOANSWER(0),SIPTAG_FROM_STR("[EMAIL PROTECTED]"),TAG_END()); } fprintf(stderr,"step1 finished\n"); fprintf(stderr,"step2 dealloc\n"); for(i=0;i<sz;i++){ //this should free nua_handle_destroy(nh[i]); } fprintf(stderr,"step2 finished\n"); pthread_join( nua_thread, NULL); } //C source stop --------------------------------------------------------------- -- beroNet GmbH Friedrich Moeller Friedrichstr. 231 Haus D, 4. OG 10969 Berlin FON: +49 (0) 30 259389-22 FAX: +49 (0) 30 259389-19 Email: [EMAIL PROTECTED] GF: Thomas Haeger HRB: Amtsgericht Berlin unter HRB97992B ******************************************* Diese E-Mail enthaelt vertrauliche und / oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and / or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sofia-sip-devel mailing list Sofia-sip-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel