Bug 104887

Summary: [Version 18.1] Memory leak when frequently create shaders on ubuntu/Linux
Product: Mesa Reporter: Jiancong <94389147>
Component: Drivers/DRI/i965Assignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: RESOLVED NOTOURBUG QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: critical    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: including opengl_demo.zip valgrind.result glxinfo.txt

Description Jiancong 2018-01-31 15:30:02 UTC
Created attachment 137091 [details]
including opengl_demo.zip valgrind.result glxinfo.txt

Hi all,
   I ran a test program in ubuntu 16.04, mesa 18.1. Please see attached glxinfo.txt for system information and opengl_demo.zip for test program.

   The test program use create simple shader 10 times. Using valgrind as following 'valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./es2tri', it easy to get a memory leak report as in attachement.

==24757== LEAK SUMMARY:
==24757==    definitely lost: 144 bytes in 2 blocks
==24757==    indirectly lost: 8,000 bytes in 40 blocks
==24757==      possibly lost: 1,460,261 bytes in 4,429 blocks
==24757==    still reachable: 165,485 bytes in 115 blocks
==24757==         suppressed: 0 bytes in 0 blocks
Comment 1 Kenneth Graunke 2018-01-31 17:55:42 UTC
Your program appears to be terminating before it reaches eglDestroyContext and the eglMakeCurrent that unbinds the context.  With the context and screen not being destroyed, we have no opportunity to clean up, and everything appears to be leaked.

If you fix your app to destroy the context, there should be no leaks.
Comment 2 Jiancong 2018-02-01 02:15:30 UTC
As you said, I changed the exit event loop using "Esc" key, avoiding the error, there is no leaks.

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.