"Mismatched free() / delete / delete []" errors when
my code is correct?</a>
</dd>
+<dd>4.8. <a href="faq.html#faq.hangs">Why does Valgrind hang when using tcmalloc?</a>
+</dd>
</dl>
<dl>
<dt>5. <a href="faq.html#faq.misc">Miscellaneous</a>
</p>
</td>
</tr>
+<tr><td colspan="2"> </td></tr>
+<tr class="question">
+<td align="left" valign="top">
+<a name="faq.hangs"></a><a name="q-hangs"></a><b>4.8.</b>
+</td>
+<td align="left" valign="top"><b>Why does Valgrind hang when using tcmalloc?</b></td>
+</tr>
+<tr class="answer">
+<td align="left" valign="top"><a name="a-hangss"></a></td>
+<td align="left" valign="top">
+<p>This is because tcmalloc makes a recursive call in its initialisation code.
+ Under Valgrind that becomes either an infinite loop with optimised builds of tcmalloc
+ or a stack overflow crash with debug builds of it.</p>
+<p>Your options are:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">Do not use tcmalloc in the builds that you test with Valgrind.</li>
+<li class="listitem">Use an older version of tcmalloc. This problem started on 2024-03-24.
+ If you use gperftools 2.15 or older you should not have this problem.</li>
+</ul></div>
+<p>
+ </p>
+</td>
+</tr>
</table>
<br><table width="100%" summary="Q and A Div" cellpadding="2" cellspacing="2" border="0">
<tr class="qandadiv"><td align="left" valign="top" colspan="2">