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

Johansson Olle E olle at voop.com
Sun Nov 12 13:56:23 MST 2006


12 nov 2006 kl. 21.41 skrev Luigi Rizzo:

> at first i missed it, but when i recently started playing with
> the new container code it struck my eyes that
> struct sip_pvt has size 5472 bytes (more if you include the lock and
> link field).
>
> The culprit seems to be this large field
> 	struct sip_request initreq
> which alone consumes 4644 bytes (4096 of which are for
> the packet buffer, sized SIP_MAX_PACKET)
>
> Given that this is always initialized from a known message
> in initialize_initreq(), would it make sense to allocate it
> with the exact size rather than with the default maximum size ?
> Besides, this would also save time in initializing it,
> as we don't have to copy the full block but only the data
> actually used.
>
Open a branch and produce a patch for review!

Thanks.

/O

---
Olle E. Johansson * Asterisk Evangelist, developer * VOOP A/S
olle at voop.com





More information about the asterisk-dev mailing list