<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">I would rather leave these items as ao2 objects.  They certainly<br>don't need the lock and you have identified some other<br>improvements.</p><p style="white-space: pre-wrap; word-wrap: break-word;">The beauty of keeping them ao2 objects is you don't need to worry<br>about calling an appropriate destructor function if there even is<br>one when the ref is decremented.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Personally I disagree, these objects are so limited in scope that using AO2 for them seems similar to using RAII_VAR in a scope with only one or two escapes.  Even without locking the private part of the AO2 object would be 50% larger than the user_data (on x86_64 anyways).  On my system these objects currently have 16 bytes user data, 64 bytes AO2 private data (with AO2_DEBUG disabled).  Replacing these with NOLOCK AO2 objects would still more than double the size and cause the user_data to always cross a 32-byte boundary.</p><p style="white-space: pre-wrap; word-wrap: break-word;">As for accidentally using the wrong cleanup method, I think that's the responsibility of reviewers to catch this.  I'd expect anyone making/reviewing changes to threadpool.c to give attention to details such as this.  If I added a '\note' to the doxygen of each allocation routine saying how to free would that make you OK with using ast_malloc instead of ao2?</p><p><a href="https://gerrit.asterisk.org/10470">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10470">change 10470</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10470"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I2204d2615d9d952670fcb48e0a9c0dd1a6ba5036 </div>
<div style="display:none"> Gerrit-Change-Number: 10470 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Sat, 13 Oct 2018 10:42:59 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-HasLabels: No </div>