From owner-freebsd-x11@FreeBSD.ORG Wed Jan 2 23:00:54 2008 Return-Path: Delivered-To: x11@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACEB316A46B for ; Wed, 2 Jan 2008 23:00:54 +0000 (UTC) (envelope-from cokane@freebsd.org) Received: from QMTA05.emeryville.ca.mail.comcast.net (qmta05.emeryville.ca.mail.comcast.net [76.96.30.48]) by mx1.freebsd.org (Postfix) with ESMTP id 7628813C465 for ; Wed, 2 Jan 2008 23:00:54 +0000 (UTC) (envelope-from cokane@freebsd.org) Received: from OMTA11.emeryville.ca.mail.comcast.net ([76.96.30.36]) by QMTA05.emeryville.ca.mail.comcast.net with comcast id YHjA1Y0080mlR8U0A0V800; Wed, 02 Jan 2008 23:00:53 +0000 Received: from discordia ([24.60.136.97]) by OMTA11.emeryville.ca.mail.comcast.net with comcast id YP0l1Y00B26FYqY8X00000; Wed, 02 Jan 2008 23:00:46 +0000 X-Authority-Analysis: v=1.0 c=1 a=4jxFm_7p1R8pXZXBeZ0A:9 a=70iXA5eARZWh4HKIMvIA:7 a=qs3t24Lj0huqf6XjFlT069WkgusA:4 a=rCbS6JjwtmAA:10 Received: by discordia (Postfix, from userid 103) id 67A5E16B558; Wed, 2 Jan 2008 18:00:52 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.1.8-gr1 (2007-02-13) on discordia X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.8-gr1 Received: from [172.20.1.3] (erwin.int.cokane.org [172.20.1.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by discordia (Postfix) with ESMTP id BA7EF1634F6; Wed, 2 Jan 2008 18:00:37 -0500 (EST) Message-ID: <477C1750.9050506@FreeBSD.org> Date: Wed, 02 Jan 2008 17:59:28 -0500 From: Coleman Kane Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.9 (X11/20071116) MIME-Version: 1.0 To: Peter Jeremy References: <477BBB39.6070208@FreeBSD.org> <20080102182923.GM903@server.vk2pj.dyndns.org> In-Reply-To: <20080102182923.GM903@server.vk2pj.dyndns.org> X-Enigmail-Version: 0.96a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: x11@freebsd.org Subject: Re: Xorg memory leak X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: cokane@FreeBSD.org List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 23:00:54 -0000 Peter Jeremy wrote: > On Wed, Jan 02, 2008 at 11:26:33AM -0500, Coleman Kane wrote: > >> I'm running into some weird problem where the memory usage of Xorg will >> keep increasing and increasing as time goes on. I first noticed teh >> problem when I had a long-running process inside of gnome-terminal that >> was constantly dumping lines of data to stdout. Eventually the memory >> usage of the Xorg process would spiral out of control (Virtual Size in >> excess of 6GB). Upon reaching maximum memory utilization, X clients >> begin to die with BadAlloc errors and the only way to fix the problem is >> to stop Xorg and then restart it. >> > > This could also be caused by a resource leak or deliberate action by a > client. Firefox in particular will "cache" all images in the X server > and this can make the X server bloat alarmingly (though the biggest > size I've seen is 1.5GB). > > Have you tried exiting from long-running clients to identify if the > problem is on the server or client side? > Yeah, I've tried exiting. I noticed it while doing some tests with sphinx3, using the live decoder (sphinx3 doesn't use X11 at all) from a gnome-terminal. I have tried killing off all gnome-terminals and all gnome-pty-helper sessions that are still open, in hopes that it would alleviate these troubles. It does seem to be caused generally by all applications, but I seem to have enough control over gnome-terminal to play around with the effect. I tried the following: Start a gnome-terminal. cat /dev/random (spewing lines upon lines of random garbage to the screen) It seems that while my terminal window remains relatively small (around 80x30 characters), there doesn't seem to be any impact. However, if I drag the window border to expand the size of it (to like 220x70 or something), then it starts to chew up memory from the Xorg process. It can sometimes get so bad as to take ~100MB per second at times. Normal xterm does not seem to exhibit this behavior. One thing that I've noticed is that the memory-eating seems to coincide with the point where the gnome-terminal window's redraw rate starts to lag from the window being far too large. Switching virtual terminals back-and-forth with Firefox and/or Thunderbird running also causes the memory-consumption to occur, but not quite as quickly as my gnome-terminal experiment. For instance, my Xorg server line from top when starting this message is: 56761 cokane 1 51 0 2050M 565M select 1 21:20 9.57% Xorg Now that I've played with gnome-terminal, I have the following: 56761 cokane 1 49 0 3545M 1074M select 0 22:54 4.49% Xorg It won't go back down until Xorg is actually closed. -- Coleman