From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jonathan Payne Newsgroups: gmane.emacs.bugs Subject: bug#15946: a patch against emacs 24.3.1 for fixing the distnoted memory leak Date: Mon, 20 Jan 2014 10:43:57 +0000 Message-ID: References: <013FF6AE-1615-454A-AB1E-A289EC1E67F0@till.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1390236508 10750 80.91.229.3 (20 Jan 2014 16:48:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jan 2014 16:48:28 +0000 (UTC) To: 15946@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 20 17:48:34 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W5I1S-0000nW-F4 for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Jan 2014 17:48:26 +0100 Original-Received: from localhost ([::1]:53428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5I1S-0002CI-3x for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Jan 2014 11:48:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5I1E-00022o-Cz for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2014 11:48:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5I17-0003Nr-33 for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2014 11:48:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5I16-0003Nm-Vz for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2014 11:48:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W5I16-0007Fe-LV for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2014 11:48:04 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <013FF6AE-1615-454A-AB1E-A289EC1E67F0@till.com> Resent-From: Jonathan Payne Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Jan 2014 16:48:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15946 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 15946-submit@debbugs.gnu.org id=B15946.139023647427814 (code B ref 15946); Mon, 20 Jan 2014 16:48:04 +0000 Original-Received: (at 15946) by debbugs.gnu.org; 20 Jan 2014 16:47:54 +0000 Original-Received: from localhost ([127.0.0.1]:58548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5I0u-0007EW-WD for submit@debbugs.gnu.org; Mon, 20 Jan 2014 11:47:54 -0500 Original-Received: from mail-wg0-f46.google.com ([74.125.82.46]:53598) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5CKn-00046w-H2 for 15946@debbugs.gnu.org; Mon, 20 Jan 2014 05:44:02 -0500 Original-Received: by mail-wg0-f46.google.com with SMTP id x12so6597574wgg.13 for <15946@debbugs.gnu.org>; Mon, 20 Jan 2014 02:44:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:content-transfer-encoding :subject:message-id:date:to:mime-version; bh=fU8b+m+inU0hdfyqAwiNGns+1D/EuKAMf8ZUheUgLG0=; b=mLGmnIzMCj3KsRuwku2CHWP4LL31OLtiphy0coMhG6nUO6M9RmDiXMYbl09txBu+HV Q/nPn7oZc8G+Fc1KUsqN/SrfqnOUeLyCZ8mz1wZRXmuGhRk4zjKj2NKmbiuELKZCElnj dTPdxQsj7ONYgyk/wlVyC63fHw7m4XhdnJ6KBDqsEFLLFOJz8ftM6JP8d3FBy43BuzZC Ihl2HDCwuVSMdWwG5h/iDBTucoa2xzVD3bf32kKV/fmdEoOqDLfZ0wraaK+vqF+zCG5p yK8Zn4Z3cwE1GZ0HE9ePQZYTz0+k4TcuJKYTUUvZ7KxZXM2yLL0LfAsXEU3ySStLOLwJ qUEA== X-Gm-Message-State: ALoCoQnarVhEWC78Xm72pmQI+MpP3vyfnged0ENV/f7w5qlLOBi2kR2S7AmTtE/gwgPL2E9xQ+7V X-Received: by 10.194.59.210 with SMTP id b18mr1002339wjr.60.1390214640287; Mon, 20 Jan 2014 02:44:00 -0800 (PST) Original-Received: from [10.0.1.92] (cpc7-camd15-2-0-cust712.20-2.cable.virginm.net. [94.174.158.201]) by mx.google.com with ESMTPSA id j9sm800750wjz.13.2014.01.20.02.43.59 for <15946@debbugs.gnu.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 02:43:59 -0800 (PST) X-Mailer: Apple Mail (2.1827) X-Mailman-Approved-At: Mon, 20 Jan 2014 11:47:51 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83790 Archived-At: This is FYI for people who do not want to wait for emacs 24.4 and cannot = use one of the current nightlies to get around the Mavericks distnoted = issue. I am not a Mac programmer unfortunately, so take this with a grain of = salt. My analysis of the problem is this: 1) When Mavericks came out a memory leak was discovered and fixed by Jan = D. who is a frequent contributor to ns (Next Step) emacs for Mac OS X. 2) His fix, I think, was to avoid calling Application.run 20 times / = second by introducing a variable called "shouldKeepRunning" into the = Application.run method. 3) Repeatedly calling Application.run was causing a 160 byte leak each = time inside emacs. But I think it was also causing a problem with = distnoted, and I am speculating (knowing NOTHING ABOUT IT) that each = call to run() was causing some sort of registration with distnoted. That = registration, I assume, creates some sort of context in distnoted that = is substantially larger than 160 bytes. So the leak in emacs was = relatively slow, the one in distnoted was much larger. This would also explain why distnoted would get slower as time goes by = because it has hundreds of thousands of registrations, all for emacs, = which I assume it was still trying to deliver notifications to, but = really, I have no idea what I am talking about. So, I applied part of Jan D's patch to emacs-24.3 that addressed this = particular problem, and presto-chango, the leak is gone, distnoted is = happy, and all my current elisp packages work because it's still = emacs-24.3 and not emacs-24.4 which I assume is what's being created in = the trunk today. So - should I post this particular patch some place? Are other people = interested in having this patch? JP