[Mesa-dev] [Bug 108087] Memory leak in clover::kernel::argument::create<>() (i.e. clEnqueueNDRangeKernel())

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Sep 27 14:31:50 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=108087

            Bug ID: 108087
           Summary: Memory leak in clover::kernel::argument::create<>()
                    (i.e. clEnqueueNDRangeKernel())
           Product: Mesa
           Version: 18.1
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Gallium/StateTracker/Clover
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: dvdk at posteo.de
        QA Contact: mesa-dev at lists.freedesktop.org

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):

  https://github.com/gcp/leela-zero/issues/1823

I also just reported the same issue (and a patch) to Debian:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909741

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:

 
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.2/src/gallium/state_trackers/clover/core/kernel.hpp

Maybe GCC warning output or some code sanitizers will point out more issues of
this kind.

cheers,

David

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180927/51443cbc/attachment.html>


More information about the mesa-dev mailing list