[asterisk-dev] chan_sip.c - struct sip_pvt is very large...

Russell Bryant russell at digium.com
Sun Nov 12 15:36:07 MST 2006


Luigi Rizzo wrote:
> but i was asking something different,
> i.e. does anyone see any odd side effects in allocating
> the initreq separately ?

The only thing I can think of is that you take the performance hit of an 
equivalent call to malloc() to allocate it separately.  However, we already take 
the cost of the extra memory allocation for memory savings in sip_pvt for 
stringfields.  Also, as you noted, you get the benefit of saving time on 
initializing the structure when it is allocated.

To improve this specific situation, we could implement a cache of these 
structures as I did for ast_frame and iax_frame structures.  For each of those 
structures, there is a per-thread cache of unused structs so that they can be 
reused without calling malloc/free so frequently.  I used your TSC profiling 
tool to measure the benefits and measured up to a 60% performance improvement.

-- 
Russell Bryant
Software Engineer
Digium, Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: russell.vcf
Type: text/x-vcard
Size: 266 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20061112/12e4ddd3/russell.vcf


More information about the asterisk-dev mailing list