osip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [osip-dev] Newbie for osip


From: Austin Einter
Subject: Re: [osip-dev] Newbie for osip
Date: Thu, 11 Dec 2014 12:48:24 +0530

Hi Aymeric
Thanks for response , I tried multiple things and I find issue one or other (either crash or memory leak).

I am trying to do register and un-register in a continuous loop.

Something like


#define MAX_OP_COUNT 10

1. initialize osip


2. while (index < MAX_OP_COUNT)
    {
        register();
        unregister();
    }

2. release osip


And here is the summary of my test code.

osip_t *osip;
osip_transaction_t *transaction = NULL;
osip_message_t *msg = NULL;
osip_event_t *sipevent;

osip_init (&osip);
set_my_osip_callbacks(osip); //Here I set all callbacks

msg = create_my_reg_message(); //here I create a register message and adds the headers
osip_transaction_init(&transaction, NICT,  osip_instance , msg);

osip_transaction_set_your_instance(transaction, my_context);
sipevent = osip_new_outgoing_sipmessage (msg);
sipevent->transactionid =  transaction->transactionid;
osip_message_force_update(msg);
osip_transaction_add_event (transaction, sipevent);

Here is my callback function
void my_kill_transaction_callback(int type, osip_transaction_t *trans)
{
    osip_t *osip;
    my_context = osip_transaction_get_your_instance(trans);
    osip = my_context->osip;

    osip_remove_transaction (instance->osip, trans);
    //osip_transaction_free2(trans);
    //osip_transaction_free(trans);
}

In above callback function, If I call only osip_remove_transaction, the registration / un-registration everything goes fine, but with valgrind I can find lot of memory leaks. Also I tried to run it for longer time and find system memory foes down.

In above callback, If I call osip_transaction_free2 + osip_remove_transaction  (which is appropriate),  I face crash issue.

In above callback, If I call osip_transaction_free (osip_remove_transaction api not called),  I face crash issue.



Can you please tell if my approach is correct, or do I need to do something extra.

Best Regards
Austin



















On Wed, Dec 10, 2014 at 9:41 PM, Aymeric Moizard <address@hidden> wrote:
Hi,

I can confirm that there is no memory leak ;)
Of course, it might still be possible to find out some, but if you have
a lot of them, most probably you missed something.

You can check the eXosip code for a reference implementation
on what's needed.

If you only removed the transaction (I guess with "osip_remove_transaction"?)
then, it's not enough. At some point, you need to call:

      osip_transaction_free (tr);

In eXosip, I do this once when I'm sure the transaction is not used anymore
and when i don't need it anymore.

Regards
Aymeric


2014-12-10 15:33 GMT+01:00 Austin Einter <address@hidden>:
Dear All
Many thanks to have wonderful sip stack available.

I am trying number of things with osip.

First I did registration / un-registration in a loop.

I am finding (it is my observation)   there are some memory leak.

I used valgrind to locate memory leaks.

Most of the memory looks shows for transactions.


When kill transaction callback is invoked, I do remove transaction in that callback.

Still why I see memory leak.

Is it a known issue.

Can somebody kindly confirm it.

Best Regards
Austin



_______________________________________________
osip-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/osip-dev




--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]