Bug 23286

Summary: Memory leak caused by 100x100 glyphs
Product: xorg Reporter: Clemens Eisserer <linuxhippy>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: peter.hutterer
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 23613    
Attachments:
Description Flags
xorg log
none
testcase
none
second version of testcase
none
valgrind output
none
0001-render-Plug-a-memory-leak-in-AddGlyph.-23286.patch none

Description Clemens Eisserer 2009-08-13 02:48:38 UTC
Created attachment 28583 [details]
xorg log

The following sequence of Xrender functions triggers a memory leak when called with 100x100 glyphs:

XRenderAddGlyphs
XRenderCompositeText32
XRenderFreeGlyphs

I only saw the leak with 100x100 glyph images, however not with 96x06 or 104x104.
I attached a short testcase, triggering the problem.


I am running Fedora rawhide with a xorg-1.7 prerelease, 2.6.31.rc5, and intel-2.8.0.
Comment 1 Clemens Eisserer 2009-08-13 02:51:03 UTC
Created attachment 28584 [details]
testcase
Comment 2 Clemens Eisserer 2009-08-14 03:56:13 UTC
Created attachment 28621 [details]
second version of testcase

Passed wrong destination-picture, fixed now.
Tested, memleak does not occur with Fedora8+intel-2.1.1.
Comment 3 Clemens Eisserer 2009-08-14 05:03:36 UTC
seems to happen with the vesa driver too, most likely not intel specific.
However would be great anyway if you guys could fix it ;)
Comment 4 Carl Worth 2009-08-17 13:46:00 UTC
(In reply to comment #3)
> seems to happen with the vesa driver too, most likely not intel specific.
> However would be great anyway if you guys could fix it ;)

Thanks for the detailed report, and for identifying it as a non-driver-specific issue.

-Carl
Comment 5 Michel Dänzer 2009-09-01 01:14:13 UTC
Seems to be a regression per comment #2, so should probably be considered for 1.7.
Comment 6 Clemens Eisserer 2009-09-02 02:41:59 UTC
Created attachment 29101 [details]
valgrind output
Comment 7 Clemens Eisserer 2009-09-02 09:20:13 UTC
Could this be somehow related to bug 23645?
Comment 8 Michel Dänzer 2009-09-03 07:24:17 UTC
How do you determine the p(In reply to comment #7)
> Could this be somehow related to bug 23645?

Does it only happen if uploading several glyphs at once?
Comment 9 Clemens Eisserer 2009-09-22 01:07:51 UTC
Yes.

When I upload one-by-one, using the same code-paths everything seems to work fine.
Comment 10 Peter Hutterer 2009-09-22 18:27:11 UTC
Created attachment 29785 [details] [review]
0001-render-Plug-a-memory-leak-in-AddGlyph.-23286.patch

The FreePicture call was missing from AddGlyph, this caused the leak. Just adding the line to make it identical to the DeleteGlyph part doesn't leak memory anymore.
This patch moves that part out of both into a static function to share between the two but the net effect is just adding the FreePicture call to AddGlyph.

I wonder if AllocateGlyph (on the bail code path) is affected by this too. Looking at the code, I'm not 100% sure.
Comment 11 Peter Hutterer 2009-09-24 16:09:41 UTC
Ping? can I have a tested-by or ACK for the above patch please?
Comment 12 Peter Hutterer 2009-09-27 20:02:41 UTC
Pushed to master as f772014c435f56db56520ca13ffa39431684f122, no complaints from xorg-devel about the patch. Extra verification would be appreciated.
Comment 13 Peter Hutterer 2009-09-30 19:02:12 UTC
commit f772014c435f56db56520ca13ffa39431684f122
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Sep 23 10:53:51 2009 +1000

    render: Plug a memory leak in AddGlyph. (#23286)


Closing as fixed, thanks for reporting.

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.