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

Johansson Olle E olle at voop.com
Mon Nov 13 05:09:35 MST 2006


12 nov 2006 kl. 23.36 skrev Russell Bryant:

> 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.

The Green Asterisk - we reuse memory allocations! Propably more  
enviornmentally friendly, less CPU exhaust fumes...

/O ;-)


More information about the asterisk-dev mailing list