Bug 108087 - Memory leak in clover::kernel::argument::create<>() (i.e. clEnqueueNDRangeKernel())
Summary: Memory leak in clover::kernel::argument::create<>() (i.e. clEnqueueNDRangeKer...
Status: RESOLVED WONTFIX
Alias: None
Product: Mesa
Classification: Unclassified
Component: Gallium/StateTracker/Clover (show other bugs)
Version: 18.1
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 99553
  Show dependency treegraph
 
Reported: 2018-09-27 14:31 UTC by dvdk
Modified: 2018-11-21 22:02 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description dvdk 2018-09-27 14:31:50 UTC
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
Comment 1 Jan Vesely 2018-09-27 19:55:06 UTC
Mesa 18.1.9 was the last release in 18.1.x series [0].

Is there a reason that prevents upgrading to 18.2 series?
Almost all OpenCL related memory leaks were addressed in that release (also in libdrm 2.4.93)

[0] https://lists.freedesktop.org/archives/mesa-dev/2018-September/205877.html

PS: for completeness the commit that addressed this in 18.2 is 2f1ad72ac17268989d4033e8e3f9460c68eae462
Comment 2 Jan Vesely 2018-11-21 19:08:52 UTC
Dylan, are there any plans wrt 18.1?
If not, I think this one should be closed as WONTFIX.
Comment 3 Dylan Baker 2018-11-21 22:02:30 UTC
Mesa 18.1 is EOL at this point and there will be no more releases, if you can still reproduce this with 18.2 or current master later please reopen.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.