From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: Memory leak in keyboard variables? Date: Sat, 20 Dec 2008 10:37:19 -0800 (PST) Message-ID: <200812201837.mBKIbJw0027951@mothra.ics.uci.edu> 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> <494D10A1.1000905@swipnet.se> <200812201745.mBKHjbUh027877@mothra.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1229798267 799 80.91.229.12 (20 Dec 2008 18:37:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Dec 2008 18:37:47 +0000 (UTC) Cc: Chong Yidong , "Stephen J. Turnbull" , Markus Triska , emacs-devel@gnu.org To: Jan =?utf-8?Q?Dj=C3=A4rv?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 20 19:38:52 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 1LE6iw-0000Vk-RJ for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2008 19:38:51 +0100 Original-Received: from localhost ([127.0.0.1]:41847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LE6hk-0006e0-FZ for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2008 13:37:36 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LE6he-0006dg-DY for emacs-devel@gnu.org; Sat, 20 Dec 2008 13:37:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LE6hc-0006cv-Vb for emacs-devel@gnu.org; Sat, 20 Dec 2008 13:37:30 -0500 Original-Received: from [199.232.76.173] (port=55326 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LE6hc-0006cs-M9 for emacs-devel@gnu.org; Sat, 20 Dec 2008 13:37:28 -0500 Original-Received: from sallyv2.ics.uci.edu ([128.195.1.120]:41851) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1LE6hc-0004R0-4V for emacs-devel@gnu.org; Sat, 20 Dec 2008 13:37:28 -0500 Original-Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by sallyv2.ics.uci.edu (8.13.7+Sun/8.13.7) with ESMTP id mBKIbJuX000852; Sat, 20 Dec 2008 10:37:19 -0800 (PST) Original-Received: (from dann@localhost) by mothra.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id mBKIbJw0027951; Sat, 20 Dec 2008 10:37:19 -0800 (PST) In-Reply-To: <200812201745.mBKHjbUh027877@mothra.ics.uci.edu> (Dan Nicolaescu's message of "Sat, 20 Dec 2008 09:45:37 -0800 (PST)") Original-Lines: 55 X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: mBKIbJuX000852 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-0.34, required 5, autolearn=disabled, ALL_TRUSTED -1.44, FM_MULTI_ODD2 1.10) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) 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:107134 Archived-At: Dan Nicolaescu writes: > Jan Dj=C3=A4rv writes: >=20 > > Chong Yidong skrev: > > > "Stephen J. Turnbull" writes: > > >=20 > > >> Chong Yidong writes: > > >> > Markus Triska writes: > > >> >=20 > > >> > > Please also try emacsclient with "-c" instead of "-t" - the= re seems to > > >> > > be a probably different and still quite big leak there as w= ill. > > >> >=20 > > >> > 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-toolk= it=3Dno. > > >> > > >> The toolkits undoubtedly do their own font caching, and probably= won't > > >> release the space until Emacs exits. > > >=20 > > > Yes, this is a possibility. > > >=20 > > > 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: > > >=20 > > > (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))) > > >=20 > > > 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 func= tions > > > (in xmenu.c, menu.c, keyboard.c, and gtkutil.c) free all the memo= ry they > > > allocate, yet about 10k of memory remains unfreed with each frame > > > created. > > >=20 > >=20 > > From what I see, the frames aren't garabge collected, and then neit= her is the > > menu bar items in f->menu_bar_vector, which isn't used for the non-= toolkit case. > >=20 > > The frame is at least referenced from recent-keys, and maybe one mo= re place > > which I haven't found. > >=20 > > 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 le= ak. I've > > checked in that change. >=20 > Following that logic, maybe all Lisp_Objects in struct frame need to be= set to nil. Ignore this, Jan's patch is enough...=20