Bug 16312 - pixman-0.11.4 + xorg-server- = memory leak city
Summary: pixman-0.11.4 + xorg-server- = memory leak city
Alias: None
Product: pixman
Classification: Unclassified
Component: pixman (show other bugs)
Version: 0.1.3
Hardware: x86-64 (AMD64) Linux (All)
: medium critical
Assignee: Søren Sandmann Pedersen
QA Contact: Søren Sandmann Pedersen
URL: http://bugs.gentoo.org/show_bug.cgi?i...
Depends on:
Blocks: xorg-7.4
  Show dependency treegraph
Reported: 2008-06-11 13:47 UTC by Alexandre Rostovtsev
Modified: 2008-06-13 12:47 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:

Fix memory leak in pixman_regionXX_copy_from_regionXX() (1.43 KB, patch)
2008-06-11 17:19 UTC, Maximilian Grothusmann
Details | Splinter Review

Description Alexandre Rostovtsev 2008-06-11 13:47:02 UTC
Numerous Gentoo users (see Gentoo bug in URL field), including me, have observed massive memory leaks in the X process when using pixman-0.11.4 with xorg-server-

To reproduce, open up gnome-terminal and run some command that prints stuff; e.g. 

while true; do echo "LEAK LEAK LEAK" ; done

On my system, with pixman-0.11.4, this will result in a leak of about 1MB per second!

Most users on the Gentoo bug, including myself, have reported that downgrading to pixman-0.10.0 removes the leaks and makes X usable again.

For what it's worth, I am on an amd64 machine, using gcc-4.3.1, kernel with some Gentoo patches, and nvidia's binary drivers (I have seen the leak in both versions 169.12 and 173.14.05). Other users on the Gentoo bug have seen the same leak on different configurations.
Comment 1 Maximilian Grothusmann 2008-06-11 17:19:34 UTC
Created attachment 17064 [details] [review]
Fix memory leak in pixman_regionXX_copy_from_regionXX()

This patch should help. :-)
Comment 2 Alexandre Rostovtsev 2008-06-11 17:46:55 UTC
(In reply to comment #1)
> This patch should help. :-)

It does. A quick test with the patch shows no more memory leak.
Comment 3 Mikko C. 2008-06-12 11:48:39 UTC
This might not be the same problem, but the patch doesn't solve it for me.
I'm running xserver from git, together with many other stuff from git: mesa, xf86-video-ati, libdrm, dr2proto, etc...

I keep having consistent memory leak, with or without composite enabled.
xrestop shows no particular application using memory.

Also, downgrading to pixman-0.10.0, as suggested in the Gentoo bug, doesn't solve the problem. I'm also using Gentoo btw.

I'm running KDE4 if it makes a difference.
Comment 4 Andrew Randrianasulu 2008-06-12 15:14:04 UTC
I have slackware-current (mostly), with Xserver git self-compiled with gcc-4.2.2.
Right now i'm using X server compiled from this source: 
commit c37a93b4850866c713e3cbf39a08bbc9645e24d4

I noticed memory leak with simple x11perf app. If i run -aa10text test - it will eat my memory quickly. Downgrading to pixman from around May, 26 solved this particular problem for me. Further bisecting point at

guest@slax:~/source/pixman$ git bisect bad
703f82cd02f5224632b4b7f7f3f072067fa4f76d is first bad commit
commit 703f82cd02f5224632b4b7f7f3f072067fa4f76d
Author: SГёren Sandmann <sandmann@redhat.com>
Date:   Sun Jun 8 22:20:44 2008 -0400

    Use 32 bit regions internally

:040000 040000 0c72f0513f9ebd7ab48f8bfa970efe140bc7ff62 1d8f239a3e801717027117a9e3dd765d49a86b79 M      pixman

this commit in pixman's tree.

But i'm not sure, because there was another bug, with black window in gkrellm (2.3.1, on gtk 2.12.9), fixed in pixman master. Will try to to isolate these two bugs ...
Comment 5 Andrew Randrianasulu 2008-06-12 15:37:18 UTC
patch from comment #1 helps here, no memory leak after x11perf -aa10text.
also, commit de150bf82fbe0e346fa38eae10a5bd43538bb3d9 in pixman master git tree is OK.

I'm using nouveau driver with TNT2 card, so no render acceleration here. Also, i have following CPU

processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 6
model           : 3
model name      : AMD Duron(tm) Processor
stepping        : 1
cpu MHz         : 950.122
cache size      : 64 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr syscall mmxext 3dnowext 3dnow up
bogomips        : 1902.14
clflush size    : 32

Hope this bug will be fixed in master soon.
Comment 6 Donnie Berkholz 2008-06-13 12:47:40 UTC
To: xorg-commit@lists.freedesktop.org
Subject: pixman: Branch 'master'
Date: Fri, 13 Jun 2008 12:45:02 -0700 (PDT)
From: Donnie Berkholz <dberkholz@kemper.freedesktop.org>

 pixman/pixman-region16.c |    5 ++++-
 pixman/pixman-region32.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 29d144712e558aaeb49f4384028dd669d76a410b
Author: Maximilian Grothusmann <maxi@own-hero.net>
Date:   Fri Jun 13 12:44:50 2008 -0700

    Fix memory leak by freeing boxes{16,32}.

    After calling pixman_region_init_rects() or
    pixman_region32_init_rects(), boxes{16,32} were not freed before
    returning. Fixes bug 16312.

Søren, thanks for reviewing it!

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.