From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#37321: 27.0.50; Excessive gc in a use case (el-search) Date: Sat, 14 Sep 2019 10:57:35 -0700 Organization: UCLA Computer Science Department Message-ID: References: <87lfv1pm5x.fsf@web.de> <874l1mc01w.fsf@web.de> <87woeidd4g.fsf@web.de> <733d0142-51ee-55df-de0c-cca7c989b370@cs.ucla.edu> <83blvnz31q.fsf@gnu.org> <838sqryzc2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2A9BF341CD77F2433AF454DE" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="110621"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Cc: michael_heerdegen@web.de, 37321@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 14 19:58:17 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i9CJL-000SVk-DT for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Sep 2019 19:58:15 +0200 Original-Received: from localhost ([::1]:51578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9CJJ-0004Fc-Rb for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Sep 2019 13:58:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47281) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9CJA-0004FQ-KE for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2019 13:58:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9CJ8-0008QR-CM for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2019 13:58:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38304) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i9CJ8-0008QE-8n for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2019 13:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i9CJ8-00040M-4l for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2019 13:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Sep 2019 17:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37321 X-GNU-PR-Package: emacs Original-Received: via spool by 37321-submit@debbugs.gnu.org id=B37321.156848387015366 (code B ref 37321); Sat, 14 Sep 2019 17:58:02 +0000 Original-Received: (at 37321) by debbugs.gnu.org; 14 Sep 2019 17:57:50 +0000 Original-Received: from localhost ([127.0.0.1]:47125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i9CIv-0003zm-GN for submit@debbugs.gnu.org; Sat, 14 Sep 2019 13:57:49 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41432) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i9CIs-0003zW-0N for 37321@debbugs.gnu.org; Sat, 14 Sep 2019 13:57:48 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 366801600C2; Sat, 14 Sep 2019 10:57:40 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id S1Bi-8w_aHew; Sat, 14 Sep 2019 10:57:39 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0C01A1600F1; Sat, 14 Sep 2019 10:57:39 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5upDyspo0GeC; Sat, 14 Sep 2019 10:57:38 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C83E71600C2; Sat, 14 Sep 2019 10:57:38 -0700 (PDT) In-Reply-To: <838sqryzc2.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:166466 Archived-At: This is a multi-part message in MIME format. --------------2A9BF341CD77F2433AF454DE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 9/14/19 2:57 AM, Eli Zaretskii wrote: > If we cannot give any specifics, I think at least telling users to > re-tune their GC tricks would help. I installed the attached to try to do that. --------------2A9BF341CD77F2433AF454DE Content-Type: text/x-patch; name="0001-Improve-doc-of-GC-thresholds.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Improve-doc-of-GC-thresholds.patch" >From 1acc0cc9aaf25c808a60cf09cf8a4d1c653c3aa9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 14 Sep 2019 10:53:24 -0700 Subject: [PATCH] Improve doc of GC thresholds * doc/lispref/internals.texi (Garbage Collection), etc/NEWS: Warn that control over GC is only approximate. --- doc/lispref/internals.texi | 13 ++++++++++--- etc/NEWS | 7 +++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index f85c266ede..c52999e1cd 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -533,9 +533,6 @@ Garbage Collection trigger another garbage collection. You can use the result returned by @code{garbage-collect} to get an information about size of the particular object type; space allocated to the contents of buffers does not count. -Note that the subsequent garbage collection does not happen immediately -when the threshold is exhausted, but only the next time the Lisp interpreter -is called. The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in @file{alloc.c}. Since it's defined in @code{word_size} units, the value @@ -562,6 +559,16 @@ Garbage Collection proportion. @end defopt + Control over the garbage collector via @code{gc-cons-threshold} and +@code{gc-cons-percentage} is only approximate. Although Emacs checks +for threshold exhaustion regularly, for efficiency reasons it does not +do so immediately after every change to the heap or to +@code{gc-cons-threshold} or @code{gc-cons-percentage}, so exhausting +the threshold does not immediately trigger garbage collection. Also, +for efficency in threshold calculations Emacs approximates the heap +size, which counts the bytes used by currently-accessible objects in +the heap. + The value returned by @code{garbage-collect} describes the amount of memory used by Lisp data, broken down by data type. By contrast, the function @code{memory-limit} provides information on the total amount of diff --git a/etc/NEWS b/etc/NEWS index 94c98a7ebe..252c6bf9b9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2429,6 +2429,13 @@ remote systems, which support this check. +++ ** 'memory-limit' now returns a better estimate of memory consumption. ++++ +** When interpreting 'gc-cons-percentage', Emacs now estimates the +heap size more often and (we hope) more accurately. E.g., formerly +(progn (let ((gc-cons-percentage 0.8)) BODY1) BODY2) continued to use +the 0.8 value during BODY2 until the next garbage collection, but that +is no longer true. Applications may need to re-tune their GC tricks. + +++ ** New macro 'combine-change-calls' arranges to call the change hooks ('before-change-functions' and 'after-change-functions') just once -- 2.17.1 --------------2A9BF341CD77F2433AF454DE--