From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: SB 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 21:32:03 +0900 Message-ID: References: <013FF6AE-1615-454A-AB1E-A289EC1E67F0@till.com> <7F6FC6C7-9847-4560-98CB-A09C107D1F56@jpayne.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1390221189 13616 80.91.229.3 (20 Jan 2014 12:33:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jan 2014 12:33:09 +0000 (UTC) Cc: "15946@debbugs.gnu.org" <15946@debbugs.gnu.org> To: Jonathan Payne Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 20 13:33:15 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 1W5E2V-0008Sx-DA for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Jan 2014 13:33:15 +0100 Original-Received: from localhost ([::1]:51426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5E2V-0004oC-0K for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Jan 2014 07:33:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5E2N-0004o3-6g for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2014 07:33:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5E2I-0008Dk-8o for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2014 07:33:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5E2I-0008Dg-53 for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2014 07:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W5E2H-0008L1-My for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2014 07:33:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: SB Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Jan 2014 12:33:01 +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.139022114832006 (code B ref 15946); Mon, 20 Jan 2014 12:33:01 +0000 Original-Received: (at 15946) by debbugs.gnu.org; 20 Jan 2014 12:32:28 +0000 Original-Received: from localhost ([127.0.0.1]:57898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5E1j-0008K9-La for submit@debbugs.gnu.org; Mon, 20 Jan 2014 07:32:28 -0500 Original-Received: from mail-ve0-f173.google.com ([209.85.128.173]:55205) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5E1g-0008K0-Fp for 15946@debbugs.gnu.org; Mon, 20 Jan 2014 07:32:25 -0500 Original-Received: by mail-ve0-f173.google.com with SMTP id oz11so1623208veb.4 for <15946@debbugs.gnu.org>; Mon, 20 Jan 2014 04:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=QKRHeTlIf7RKPSsOQXiolx/U16YhejMg6LjSsQaxIro=; b=ZQetwD6pr/jII4Pd8bOttmdYe9FxZHXYtYmaccY4Kk4s+k3olPitIdPtJCmpJentL9 VHUF6rdvlzaougWwiGUIEnFJSUh0HZfifiM8tuwf/qlOGq8+5nR9r3JSDkIW0jH8ywtz GbQQmbukGzJjbVe58rhogsY6diDX+5q7gIcniBJYzL8y+MYnD8LvK9obKsgGDj+nhdev 4dtygBVQKin84rNORNIJsepk+16tE+bCHGIXptrA5bF+MiH2ZLNUiBQqcErRx2b7Yftz 6wr/7hBitQ8f6q96ASXvcLkemc6t/CsbGsyguA3IMi6jNskyys8z6rLV70Snm2NKpNiQ Xrag== X-Received: by 10.220.99.72 with SMTP id t8mr10497018vcn.10.1390221144002; Mon, 20 Jan 2014 04:32:24 -0800 (PST) Original-Received: by 10.58.210.9 with HTTP; Mon, 20 Jan 2014 04:32:03 -0800 (PST) In-Reply-To: <7F6FC6C7-9847-4560-98CB-A09C107D1F56@jpayne.net> 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:83766 Archived-At: Great detective work. I'd like to see the patch! ;) Even if it's superseded by the next release (24.4), some people might be stuck on 24.3 for whatever reason and right now this bug thread is the best reference for information. In the mean time, some more experienced people can look at the patch and further isolate the relevant changes for a tighter patch or confirm your work. People with the bug can build with your patch and confirm whether this bug is fixed by it too. On Mon, Jan 20, 2014 at 9:01 PM, Jonathan Payne wrote: > 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 issu= e. > > I am not a Mac programmer unfortunately, so take this with a grain of sal= t. 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 / seco= nd by introducing a variable called "shouldKeepRunning" into the Applicatio= n.run method. > > 3) Repeatedly calling Application.run was causing a 160 byte leak each ti= me 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 ass= ume, 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 distn= oted was much larger. > > This would also explain why distnoted would get slower as time goes by be= cause 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 par= ticular problem, and presto-chango, the leak is gone, distnoted is happy, a= nd 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 int= erested in having this patch? > > JP > > > >