I think I found a memory leak.
It appears memory for handles is not being freed after the nua_handle_destroy().
The su_block_t sub_ref = 1.
So there appears to be one extra reference which is not being unreferenced.

I've been adding trace code and think I understand what may be going on here.
Each nua_xxx... function gets a reference in nua_signal().
This reference is freed at the end of nua_stack_signal().
When an event is received for a handle from the network, nua_stack_event() gets a reference.
This reference is freed after the nua callback is called in nua_event().
Other references a obtained for dialog usage as well.

The only reference I could not find a corresponding un-reference call for is in nua_stack_signal() at the very beginning:

 if (nh) {
   if (!nh->nh_prev)
     nh_append(nua, nh);
   if (!nh->nh_ref_by_stack) {
     nh->nh_ref_by_stack = 1;
     nua_handle_ref(nh);
   }
 }

I think the nua_handle_ref() call is extraneous here. Handles created by the stack in nh_create() do not get a reference.

Handles created by the stack, seem to have the same problem in nua_event():

 if (nh && !NH_IS_DEFAULT(nh)) {
   if (!nh->nh_ref_by_user && nh->nh_valid) {
     nh->nh_ref_by_user = 1;
     nua_handle_ref(nh);
   }
 }

I don't see any place where this reference is ever unreferenced.

Also, incoming INVITEs that get canceled seem to create handles which get the first reference in nua_dialog_usage_add(), but never calls nua_dialog_usage_remove(). I also see this, if the application calls nua_handle_destroy() in the callback for events nua_r_bye or nua_r_cancel.

Colin..





-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to