Re: [Sofia-sip-devel] Memory management question

2006-11-10 Thread Pekka Pessi
On 11/9/06, Diego Betancor [EMAIL PROTECTED] wrote:
 I am very confused with who manages the memory, Sofia?, the aplication?.

Both. Unfortunately the memory management is inconsistent. In some
cases, we have reference counting, in some cases the application is
responsible for destroying the objects, sometimes the stack just marks
the object as destroyed and releases its storage when appropriate.

 case 1. With a dialog finishes with a BYE or CANCEL who destroys the leg,
 Does the application have to destroy it or Sofia destroys (an liberates
 memory I presume) it automaticaly?.

Unfortunately, the dialog management with SIP is rather hairy. BYE (or
an error response to the initial INVITE, not CANCEL itself) destroys
the dialog usage, not the dialog. Here is a draft with some additional
information about SIP dialogs and when they are considered destroyed,
etc:

http://www.ietf.org/internet-drafts/draft-ietf-sipping-dialogusage-04.txt

In nta it is left entirely to application to decide when the dialog is
destroyed and therefore your application has to explicitly call
nta_leg_destroy().

 case 2. URLs and many more thing in which you need to give to the function
 your home. Case in point is the function url_as_string().

 in
 printf(The url is %s, url_as_string(home, url));

 I am just leaking memory?

That depends on your home. It is possible to use a temporary home that
lives for the duration of the function and is destroyed before
returning from the function, like

su_home_t home[1] = { SU_HOME_INIT(home) };

printf(The url is %s, url_as_string(home, url));

su_home_deinit(home);

In this particular case, there are macros URL_PRINT_FORMAT and
URL_PRINT_ARGS() that you could use (but in the expense of your
application size):

printf(The url is  URL_PRINT_FORMAT, URL_PRINT_ARGS(url));

and should be:
 char *ch
 ch = url_as_string(home, url);
 printf(The url is %s, ch);
 free(home, ch);

You have to use su_free() if you have non-NULL home:

char *ch
ch = url_as_string(home, url);
printf(The url is %s, ch);
su_free(home, ch);

 Same thing with make_url(home, sip);

 the question is I guess, I am responsible to free the memory that was
 allocated by a Sofia funtion, even if I didn't make the allocation?

That is right. The memory home is there to help with that task, so
that you could have a home that is alive while your allocations are
relevant. When the home is released all the associated memory areas
would be freed.

-- 
Pekka.Pessi mail at nokia.com

-
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=lnkkid=120709bid=263057dat=121642
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


[Sofia-sip-devel] Using SOA

2006-11-10 Thread Chris Robson

Any one have good working examples on how to use SOA?  What I thought 
was fairly straight forward isnt turning out to be the case.  Everytime 
I make any soa calls, for example to soa_create, soa_activate, my 
program hangs.  I am stepping through the program with DDD.

Thanks

-- 
Chris


-
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=lnkkid=120709bid=263057dat=121642
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


[Sofia-sip-devel] sofia-sip changes (2006-11-10)

2006-11-10 Thread Sofia-SIP Darcs Changes
This posting was generated automatically from darcs repo
http://sofia-sip.org/repos.

Fri Nov 10 09:42:44 EET 2006  [EMAIL PROTECTED]
  * nua: added test case for BYE-while-re-INVITE-is-incomplete scenario

M ./libsofia-sip-ua/nua/test_call_hold.c -6 +206
M ./libsofia-sip-ua/nua/test_nua.c -1 +1
M ./libsofia-sip-ua/nua/test_nua.h +1

Fri Nov 10 09:33:13 EET 2006  [EMAIL PROTECTED]
  * nua: updated documentation of nua events

M ./libsofia-sip-ua/nua/Doxyfile +3
M ./libsofia-sip-ua/nua/nua.c -18 +8
M ./libsofia-sip-ua/nua/nua.docs -103 +197
M ./libsofia-sip-ua/nua/nua_message.c -16 +26
M ./libsofia-sip-ua/nua/nua_notifier.c -22 +43
M ./libsofia-sip-ua/nua/nua_options.c +21
M ./libsofia-sip-ua/nua/nua_params.c -4 +33
M ./libsofia-sip-ua/nua/nua_publish.c -26 +60
M ./libsofia-sip-ua/nua/nua_register.c -22 +63
M ./libsofia-sip-ua/nua/nua_registrar.c -5 +7
M ./libsofia-sip-ua/nua/nua_session.c -63 +277
M ./libsofia-sip-ua/nua/nua_stack.c +73
M ./libsofia-sip-ua/nua/nua_subnotref.c -35 +70

Fri Nov 10 09:29:33 EET 2006  [EMAIL PROTECTED]
  * configure.ac: bumped package version to 1.12.3work2

M ./configure.ac -1 +1

Fri Nov 10 09:28:36 EET 2006  [EMAIL PROTECTED]
  * nth: fixed subdir handling with nth server.

M ./libsofia-sip-ua/nth/Makefile.am +1
M ./libsofia-sip-ua/nth/nth_server.c -69 +253
M ./libsofia-sip-ua/nth/test_nth.c -46 +147

Thu Nov  9 18:33:07 EET 2006  [EMAIL PROTECTED]
  * bnf.c: fixed host_is_local() checks.

M ./libsofia-sip-ua/bnf/bnf.c -4 +14
M ./libsofia-sip-ua/bnf/torture_bnf.c +4

Thu Nov  9 16:48:35 EET 2006  [EMAIL PROTECTED]
  * nth: renamed nth_test.c as test_nth.c

 ./libsofia-sip-ua/nth/nth_test.c - ./libsofia-sip-ua/nth/test_nth.c
M ./libsofia-sip-ua/nth/Makefile.am -1 +1 r1
M ./libsofia-sip-ua/nth/test_nth.c r1

Thu Nov  9 16:42:52 EET 2006  [EMAIL PROTECTED]
  * RELEASE: updated.

M ./RELEASE +7

Thu Nov  9 16:32:47 EET 2006  [EMAIL PROTECTED]
  * sres: trying to avoid scheduling extra callbacks. Added 
sres_resolver_set_timer_cb().

M ./libsofia-sip-ua/sresolv/sofia-resolv/sres_async.h +19
M ./libsofia-sip-ua/sresolv/sres.c +23
M ./libsofia-sip-ua/sresolv/sresolv.c +18

-
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=lnkkid=120709bid=263057dat=121642
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel