Bug 38634

Summary: Memory leak when restarting AwesomeWM (valgrind included)
Product: xorg Reporter: Emmanuel Lepage Vallee <elv1313>
Component: Server/DDX/XorgAssignee: Peter Hutterer <peter.hutterer>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: high CC: daniel, peter.hutterer, psychon
Version: 7.6 (2010.12)   
Hardware: All   
OS: Linux (All)   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:
Attachments:
Description Flags
Valgrind output none

Description Emmanuel Lepage Vallee 2011-06-23 22:04:58 UTC
Created attachment 48367 [details]
Valgrind output

I have a memory leak when I restart awesome. Everytime I do it, X take an exponentially greater memory space. Taking up to 16gb after 100 restart.

AwesomeWM use XCB to talk with Xorg. As this X binding seem to be less used, it may be why nobody noticed this leak before. It is present in X  since longer than I experience it. I now have multiple screens and the problem is now too big to ignore. It's why I manually compiled X to see if I could do something, I don't. But I have produced this valgrind file in the hope that someone can find the problem.

To repeat the problem, do:
1- Plug multiple screen, as it make the problem bigger and easier to see
2- Start AwesomeWM with the config found on http://github.com/Elv13
3- Restart Awesome using super+ctrl+r a few time
4- Look how much X now take

This bug also cause Event to take longer to be parsed, making gaming impossible (causing high latency). Sysprof show that X is responsible too. When the leak get really bad, X take over 75% of Sysprof profiled time.
Comment 1 Alan Coopersmith 2011-06-23 22:13:53 UTC
One of the big winners in that output is:

==15149== 917,504 bytes in 512 blocks are still reachable in loss record 622 of 623
==15149==    at 0x4C26D89: calloc (vg_replace_malloc.c:467)
==15149==    by 0x439FF2: InitEventList (getevents.c:1033)
==15149==    by 0x482686: mieqInit (mieq.c:114)
==15149==    by 0x45DBF1: InitInput (xf86Init.c:807)
==15149==    by 0x420EC4: main (main.c:259)

so cc'ing the input gurus for their insight.
Comment 2 Peter Hutterer 2011-06-26 17:42:08 UTC
http://patchwork.freedesktop.org/patch/6140/
Comment 3 Julien Cristau 2011-07-02 09:54:28 UTC
commit 87d4f90bfcb509471ac9e7886e14a92b33223fd7
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Jun 27 09:10:42 2011 +1000

    input: free the EQ allocated memory on shutdown (#38634)
    
    mieqFini() already does the right thing, but it needs to be called by the
    various DDXs and the XTest Extension.
    
    X.Org Bug 38634 <http://bugs.freedesktop.org/show_bug.cgi?id=38634>
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
    Acked-by: Jeremy Huddleston <jeremyhu@apple.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Comment 4 Emmanuel Lepage Vallee 2011-11-13 15:19:55 UTC
It is still present in 1.11.2, so I reopen the bug. Even if xserver do the "right" thing, as long as it continue to easy gigs or ram (and need to be restarted to free it), it is still a bug.
Comment 5 Jeremy Huddleston Sequoia 2011-11-20 21:29:08 UTC
Can you please provide a new valgrind report with a server that contains the fix.
Comment 6 Peter Hutterer 2013-08-08 06:52:00 UTC
Claiming as fixed based on comment #3, reported never provided additional info required. If this leak still exists, please open a new bug.

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.