From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: Memory leak in keyboard variables? Date: Sat, 20 Dec 2008 16:34:57 +0100 Message-ID: <494D10A1.1000905@swipnet.se> References: <87d4fzh0qc.fsf@cyd.mit.edu> <87y6ymiw93.fsf@cyd.mit.edu> <8763lqcuju.fsf@stupidchicken.com> <87bpvccirc.fsf@cyd.mit.edu> <877i5z1kka.fsf@xemacs.org> <87ocz7pqbj.fsf@cyd.mit.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1229787323 1126 80.91.229.12 (20 Dec 2008 15:35:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Dec 2008 15:35:23 +0000 (UTC) Cc: "Stephen J. Turnbull" , Markus Triska , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 20 16:36:29 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LE3sS-0002uM-52 for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2008 16:36:28 +0100 Original-Received: from localhost ([127.0.0.1]:40982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LE3rF-0005wK-4n for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2008 10:35:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LE3r8-0005v8-8M for emacs-devel@gnu.org; Sat, 20 Dec 2008 10:35:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LE3r4-0005tr-1R for emacs-devel@gnu.org; Sat, 20 Dec 2008 10:35:05 -0500 Original-Received: from [199.232.76.173] (port=55715 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LE3r3-0005ti-ME for emacs-devel@gnu.org; Sat, 20 Dec 2008 10:35:01 -0500 Original-Received: from proxy3.bredband.net ([195.54.101.73]:56842) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LE3r3-0005q3-9t for emacs-devel@gnu.org; Sat, 20 Dec 2008 10:35:01 -0500 Original-Received: from ironport.bredband.com (195.54.101.120) by proxy3.bredband.net (7.3.127) id 492A9CFF00A4ED38 for emacs-devel@gnu.org; Sat, 20 Dec 2008 16:34:58 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av82ADifTElV4S1uPGdsb2JhbACBa4ceilMBAQEBNad3WJBwhkM Original-Received: from c-6e2de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.110]) by ironport1.bredband.com with ESMTP; 20 Dec 2008 16:34:58 +0100 Original-Received: from [172.20.199.2] (gaffa [172.20.199.2]) by coolsville.localdomain (Postfix) with ESMTP id A14377FA07A; Sat, 20 Dec 2008 16:34:57 +0100 (CET) User-Agent: Thunderbird 2.0.0.18 (X11/20081125) In-Reply-To: <87ocz7pqbj.fsf@cyd.mit.edu> X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:107124 Archived-At: Chong Yidong skrev: > "Stephen J. Turnbull" writes: > >> Chong Yidong writes: >> > Markus Triska writes: >> > >> > > Please also try emacsclient with "-c" instead of "-t" - there seems to >> > > be a probably different and still quite big leak there as will. >> > >> > With the recent fix to font_clear_cache, the leak is reduced to 30-40k >> > per frame. This leak seems to be tied to GTK and X toolkits somehow. >> > It does not appear when Emacs is compiled with --with-x-toolkit=no. >> >> The toolkits undoubtedly do their own font caching, and probably won't >> release the space until Emacs exits. > > Yes, this is a possibility. > > Another data point: the leak occurs when the menu-bar is enabled, but > not when the menu-bar is disabled. It's not necessary to see the leak > using Emacsclient, as ordinary frame creating/deletion shows it: > > (dotimes (i 15) > (let* ((params '((window-system . x) > (menu-bar-lines . 1) > (tool-bar-lines . 1))) > frame) > (setq frame (x-create-frame params)) > (delete-frame frame) > (garbage-collect))) > > I have not been able to track down the source of this leak within Emacs. > As far as I can tell, the existing menu-bar items allocation functions > (in xmenu.c, menu.c, keyboard.c, and gtkutil.c) free all the memory they > allocate, yet about 10k of memory remains unfreed with each frame > created. > >From what I see, the frames aren't garabge collected, and then neither is the menu bar items in f->menu_bar_vector, which isn't used for the non-toolkit case. The frame is at least referenced from recent-keys, and maybe one more place which I haven't found. Setting f->menu_bar_vector to Qnil when deleting the frame improves the situation quite a bit, I'm not sure if it totally eliminates the leak. I've checked in that change. Jan D.