<div dir="ltr"><div dir="ltr">On Thu, Apr 28, 2022 at 6:43 AM Alex Hermann <<a href="mailto:alex-lists@wenlex.nl">alex-lists@wenlex.nl</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Recently a commit by Kevin Harwell changed a single pjsip_hdrs_clone()'s <br>
usage of the dlg pool to use the tdata pool instead.<br>
<br>
<a href="https://gerrit.asterisk.org/c/asterisk/+/18273/3" rel="noreferrer" target="_blank" style="">https://gerrit.asterisk.org/c/asterisk/+/18273/3</a><br>
<br>
I don't understand why this change is only needed when creating an <br>
outgoing request. Why is this not changed for an incoming request? Is <br>
there documentation on when to use which pool? Or was this simply an <br>
omission and should the other usage(s) change too?<br>
<br>
res/res_pjsip_header_funcs.c:202:<br>
<br>
static int insert_headers(pj_pool_t * pool, ....<br>
               le->hdr = pjsip_hdr_clone(pool, hdr);<br>
<br>
(pool is dlg->pool here, called from incoming_request())<br></blockquote><div><br></div><div>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.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-family:tahoma,sans-serif"><font color="#073763">Joshua C. Colp</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Asterisk Technical Lead</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Sangoma Technologies</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Check us out at <a href="http://www.sangoma.com" target="_blank">www.sangoma.com</a> and <a href="http://www.asterisk.org" target="_blank">www.asterisk.org</a></font><br></div></div></div></div></div></div></div></div></div></div></div>