[Osip] Question regarding memory usage and registrations in eXosip

Dagani Itay-BID123 itay.dagani at motorola.com
Mon Sep 29 21:20:05 CEST 2008


Hello,
 
I am using the osip2 / eXosip2 on vxWorks and I have a few questions
regarding the memory allocations / usage which I see, and I will
describe
the scenario :
 
The function that does the registrations looks like this :
 
int register(char *proxy, char *from)
{
    osip_message_t *reg = NULL;
    int expire = 3600;
    .
    .
    .
    eXosip_lock();
 
    regid = eXosip_register_build_initial_register(username, proxy,
contact, expire, &reg);
 
    eXosip_register_send_register (regid, reg)
 
    eXosip_unlock();
 
}
 
After I call the function 'eXosip_register_send_register', I see the
following stack trace :
 
'eXosip_register_send_register'
_eXosip_transaction_init
osip_transaction_init
osip_malloc
malloc
 
and for each registration I see that it uses 5944 bytes (allocating the
'osip_transaction_t' struct).
 
I ran 96egistrations on my target board , all of them are different
URI's, and I am using a memory allocation watcher
program which shows me that 100*5944 = 570624 bytes are allocated after
all 96 registrations.
 
I repeat these 96 registrations every hour.
 
I see that some of these memory allocations are freed in the following
code flow :
 
_eXosip_thread   (I use 'OSIP_MT')
eXosip_execute
eXosip_release_terminated_calls
osip_transaction_free
osip_transaction_free2
free
 
I was wondering what is the connection between releasing calls and
freeing the transaction structs I mention above ?
 
I don't see that all of these structs are freed, is that a correct
behaviour ?
 
Also, there is a function called 'eXosip_automatic_refresh' - which
according to the help page - 
Refresh REGISTER and SUBSCRIBE before the expiration delay
 
When I call 'eXosip_register_build_initial_register' the 'expires'
parameter's value is 3600 (as can seen in the description
of the registration function above) - if I initiate 96 registrations and
I will use ''eXosip_automatic_refresh' in the task like this :
 
int msg_handler()
{
 int counter = 0;
 eXosip_event_t *je;
 
 for (;;)
 {
    if (!(je = eXosip_event_wait (0, 20)))
    {
     taskDelay(100);
     continue;
    }
 
    eXosip_lock ();
    eXosip_default_action (je); 
    eXosip_automatic_refresh ();
    eXosip_unlock ();

    counter++;
 
    handle_incoming_event(je);
 
    eXosip_event_free(je);
 }
 
 if (counter > 0)
  return 0;
 
 return -1;

}
 
will all the registrations be done automatically after the expires
period ? (by the function 'eXosip_automatic_refresh') 
  
 
Thank you for your help :-)
 
Itay Dagani
 


More information about the Osip mailing list