<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Memory leak in clover::kernel::argument::create<>() (i.e. clEnqueueNDRangeKernel())"
href="https://bugs.freedesktop.org/show_bug.cgi?id=108087">108087</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Memory leak in clover::kernel::argument::create<>() (i.e. clEnqueueNDRangeKernel())
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr>
<tr>
<th>Version</th>
<td>18.1
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Gallium/StateTracker/Clover
</td>
</tr>
<tr>
<th>Assignee</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dvdk@posteo.de
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>Hi,
would you please consider adding a virtual destructor to class
clover::kernel::argument? Currently life-time of kernel::scalar_argument is
managed via unique_ptr<argument> i.e. via a pointer to the parent class.
Without virtual destructor in the parent, scalar_argument destructor never
runs. This in turn causes scalar_argument::v to leak its memory.
Details are documented as part of this leela zero bug (which turned out to be
the Mesa issue just described):
<a href="https://github.com/gcp/leela-zero/issues/1823">https://github.com/gcp/leela-zero/issues/1823</a>
I also just reported the same issue (and a patch) to Debian:
<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909741">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909741</a>
Adding the virtual destructor fixes the leak for me. Note that Mesa 18.2 also
added the virtual destructor, while the latest 18.1 version still lacks it:
<a href="https://gitlab.freedesktop.org/mesa/mesa/blob/18.1/src/gallium/state_trackers/clover/core/kernel.hpp">https://gitlab.freedesktop.org/mesa/mesa/blob/18.1/src/gallium/state_trackers/clover/core/kernel.hpp</a>
<a href="https://gitlab.freedesktop.org/mesa/mesa/blob/18.2/src/gallium/state_trackers/clover/core/kernel.hpp">https://gitlab.freedesktop.org/mesa/mesa/blob/18.2/src/gallium/state_trackers/clover/core/kernel.hpp</a>
Maybe GCC warning output or some code sanitizers will point out more issues of
this kind.
cheers,
David</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>