Bug 509760 - GEM object leak
GEM object leak
Product: Fedora
Classification: Fedora
Component: xorg-x11-drv-intel (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Adam Jackson
Fedora Extras Quality Assurance
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2009-07-05 16:43 EDT by David Zeuthen
Modified: 2013-03-05 22:58 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-12-05 01:45:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description David Zeuthen 2009-07-05 16:43:19 EDT
Description of problem:

It appears that GEM buffers allocated by (buggy) XRender clients are never freed.

To reproduce, try writing a simple gtk+ app and override the expose handler (of e.g. GtkDrawingArea) and get a cairo context that way and do some drawing. Then (since it applies to buggy apps only) avoid destroying the cairo context. 

Now, force some redraws and watch /proc/dri/0/gem_objects via e.g. 'watch -n 0.5 cat /proc/dri/0/gem_objects'. You will see that the number of objects rise and ditto for object bytes. Now kill the buggy app. The number of objects nor the object bytes don't go down.

Note that this applies to non-buggy apps as well; it's entirely possible that apps hold on to GEM objects (via XRender objects) and if such apps are killed these objects will not be garbage collected (or evicted, whatever) on process exit. This is not theoretical, for example firefox holds on to lots of objects this way.

If you continue this exercise, you will eventually run out of memory since the driver holds on to GEM objects. Eventually the OOM killer kicks in and starts killing processes.

If you kill the X server, the GEM objects are released as expected.

Version-Release number of selected component (if applicable):

Lenovo X61 with an Intel 965 chipset.
Comment 1 David Zeuthen 2009-07-05 16:56:21 EDT
Btw, just like we have process limits in the kernel, it would probably be wise to limit each X client such that a single X client can't allocate more GEM object memory than, say, half of the physical memory or whatever (or something more fancy, I don't know). At least that way, buggy apps won't bring down your system and it would make it a lot easier for the app programmer to figure out what the problem.

Anyway, just a thought FWIW, I ran into this problem myself by forgetting a cairo_destroy() call. It took me quite some time and research to figure out what's going on.

(Then again, we don't exactly do the same for malloc() or fork() (in the default install). But that's probably something that should be fixed / thought about. I, for one, always clinch my teeth whenever one of my programs accidentally run into a malloc-loop and ends up making the OOM killer take out firefox or evolution.)
Comment 3 Matěj Cepl 2009-11-05 12:13:30 EST
Since this bugzilla report was filed, there have been several major updates in various components of the Xorg system, which may have resolved this issue. Users who have experienced this problem are encouraged to upgrade their system to the latest version of their packages (at least F12Beta, but even better if the very latest versions).

Please, if you experience this problem on the up-to-date system, let us now in the comment for this bug, or whether the upgraded system works for you.

If you won't be able to reply in one month, I will have to close this bug as INSUFFICIENT_DATA. Thank you.

[This is a bulk message for all open Fedora Rawhide Xorg-related bugs. I'm adding myself to the CC list for each bug, so I'll see any comments you make after this and do my best to make sure every issue gets proper attention.]
Comment 4 Bug Zapper 2009-11-16 05:38:35 EST
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
Comment 5 Matěj Cepl 2010-05-10 19:12:50 EDT
Reporter, could you please reply to the previous question? If you won't reply in one month, I will have to close this bug as INSUFFICIENT_DATA. Thank you.
Comment 6 Bug Zapper 2010-11-04 06:51:47 EDT
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
Comment 7 Bug Zapper 2010-12-05 01:45:04 EST
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.