Re: [asterisk-dev] pjsip headers and dlg->pool vs tdata->pool
On donderdag 28 april 2022 12:07:34 CEST Joshua C. Colp wrote: > There isn't any real documentation regarding pools and their usage, > what to use ultimately depends on what you're doing and the lifetime > of it. In the case of the review you've linked, tdata could live past > the lifetime of the dialog, and thus everything part of the tdata > should be allocated from its pool and use its lifetime. For the > dialplan functions which store the information on a datastore it is > perfectly fine to use the dialog pool because the lifetime of the > dialog and the lifetime of the datastore are the same, driven by the > lifetime of the channel. Yeah, guessed so. The hard part is finding out what each lifetime is. Thanks. -- Alex Hermann -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: [asterisk-dev] pjsip headers and dlg->pool vs tdata->pool
On Thu, Apr 28, 2022 at 6:43 AM Alex Hermann wrote: > Hi, > > Recently a commit by Kevin Harwell changed a single pjsip_hdrs_clone()'s > usage of the dlg pool to use the tdata pool instead. > > https://gerrit.asterisk.org/c/asterisk/+/18273/3 > > I don't understand why this change is only needed when creating an > outgoing request. Why is this not changed for an incoming request? Is > there documentation on when to use which pool? Or was this simply an > omission and should the other usage(s) change too? > > res/res_pjsip_header_funcs.c:202: > > static int insert_headers(pj_pool_t * pool, >le->hdr = pjsip_hdr_clone(pool, hdr); > > (pool is dlg->pool here, called from incoming_request()) > There isn't any real documentation regarding pools and their usage, what to use ultimately depends on what you're doing and the lifetime of it. In the case of the review you've linked, tdata could live past the lifetime of the dialog, and thus everything part of the tdata should be allocated from its pool and use its lifetime. For the dialplan functions which store the information on a datastore it is perfectly fine to use the dialog pool because the lifetime of the dialog and the lifetime of the datastore are the same, driven by the lifetime of the channel. -- Joshua C. Colp Asterisk Technical Lead Sangoma Technologies Check us out at www.sangoma.com and www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
[asterisk-dev] pjsip headers and dlg->pool vs tdata->pool
Hi, Recently a commit by Kevin Harwell changed a single pjsip_hdrs_clone()'s usage of the dlg pool to use the tdata pool instead. https://gerrit.asterisk.org/c/asterisk/+/18273/3 I don't understand why this change is only needed when creating an outgoing request. Why is this not changed for an incoming request? Is there documentation on when to use which pool? Or was this simply an omission and should the other usage(s) change too? res/res_pjsip_header_funcs.c:202: static int insert_headers(pj_pool_t * pool, le->hdr = pjsip_hdr_clone(pool, hdr); (pool is dlg->pool here, called from incoming_request()) -- Alex Hermann -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev