Re: [Sofia-sip-devel] simple memory allocation question

2010-03-16 Thread beachdog
Thanks, Pekka.

Just to make sure I am not doing something wrong, my home gets allocated when 
my program starts, and I do not destroy it until my (long running) program 
ends.  So although it would not be a true memory leak it sounds like it would 
cause memory growth if I do not free it, and thus I would be better to free it 
immediately after nta_incoming_reply(), is that correct ?

BTW, while we are on the subject of memory allocation, I am also using messages 
using su_msg_create() to send msgs between my root and clone tasks, where I use 
the feature to have some user-specified data area allocated with the message, 
and I never explicitly need to free that memory, correct?

Also BTW, thank you very much for your work on this product.  I have great 
respect for people such as yourself that take efforts to make something 
valuable available for a community, and though I am still new to this code (but 
not to SIP) I very much enjoy it and appreciate your work.

Dave

On Mar 16, 2010, at 3:23 PM, Pekka Pessi wrote:

> 2010/3/15  :
>> Simple questionwhen I use sip_X_make( home, char *) and then attach that 
>> header to a response message I am sending via nta, do I need to explicitly 
>> su_free that header?  i.e.
>> 
>> sip_contact_t *c1 = sip_contact_make( home, szContact1 ) ;
>> nta_incoming_treply( irq, SIP_300_MULTIPLE_CHOICES,  SIPTAG_CONTACT( c1 ), 
>> TAG_END() ) ;
>> //DO I NEED TO su_free this?
> 
> Nope, it will be freed when your home is destroyed/unref:ed.
> 
>> If I do need to free it, can I do so immediately after calling 
>> nta_incoming_reply?
> 
> You can do it immediately after calling nta_incoming_reply().
> 
> -- 
> Pekka.Pessi mail at nokia.com


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] simple memory allocation question

2010-03-16 Thread Pekka Pessi
2010/3/15  :
> Simple questionwhen I use sip_X_make( home, char *) and then attach that 
> header to a response message I am sending via nta, do I need to explicitly 
> su_free that header?  i.e.
>
> sip_contact_t *c1 = sip_contact_make( home, szContact1 ) ;
> nta_incoming_treply( irq, SIP_300_MULTIPLE_CHOICES,  SIPTAG_CONTACT( c1 ), 
> TAG_END() ) ;
> //DO I NEED TO su_free this?

Nope, it will be freed when your home is destroyed/unref:ed.

> If I do need to free it, can I do so immediately after calling 
> nta_incoming_reply?

You can do it immediately after calling nta_incoming_reply().

-- 
Pekka.Pessi mail at nokia.com

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel