unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: michael_heerdegen@web.de, 37321@debbugs.gnu.org
Subject: bug#37321: 27.0.50; Excessive gc in a use case (el-search)
Date: Sat, 14 Sep 2019 10:57:35 -0700	[thread overview]
Message-ID: <d98f0762-d3ff-90e7-07ad-2b081b0aed29@cs.ucla.edu> (raw)
In-Reply-To: <838sqryzc2.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

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.

[-- Attachment #2: 0001-Improve-doc-of-GC-thresholds.patch --]
[-- Type: text/x-patch, Size: 2794 bytes --]

From 1acc0cc9aaf25c808a60cf09cf8a4d1c653c3aa9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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


  reply	other threads:[~2019-09-14 17:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 13:52 bug#37321: 27.0.50; Excessive gc in a use case (el-search) Michael Heerdegen
2019-09-07 14:23 ` Michael Heerdegen
2019-09-07 15:30   ` Michael Heerdegen
2019-09-08  1:11 ` Paul Eggert
2019-09-08 14:52   ` Michael Heerdegen
2019-09-08 15:25     ` Michael Heerdegen
2019-09-14  8:04       ` Paul Eggert
2019-09-14  8:37         ` Eli Zaretskii
2019-09-14  8:52           ` Paul Eggert
2019-09-14  9:57             ` Eli Zaretskii
2019-09-14 17:57               ` Paul Eggert [this message]
2019-09-14 18:16                 ` Eli Zaretskii
2019-09-15  4:33             ` Richard Stallman
2019-09-16 23:53         ` Michael Heerdegen
2019-09-17  0:55           ` Paul Eggert
2019-09-21  0:41             ` Michael Heerdegen
2019-09-21  0:46               ` Michael Heerdegen
2019-09-21  6:19                 ` Paul Eggert
2019-09-17 12:47           ` Noam Postavsky
2019-09-21  0:44             ` Michael Heerdegen
2019-09-25  9:42         ` Michael Heerdegen
2019-09-25 20:37           ` Paul Eggert
2019-09-26 11:42             ` Michael Heerdegen
2019-09-26 12:14               ` Eli Zaretskii
2019-09-26 13:03                 ` Michael Heerdegen
2019-10-08  8:43                 ` Michael Heerdegen
2019-10-08  9:09                   ` Eli Zaretskii
2019-10-08  9:11                     ` Michael Heerdegen
2019-10-08  9:19                       ` Eli Zaretskii
2019-10-08 11:12                         ` Michael Heerdegen
2019-10-08 12:11                           ` Eli Zaretskii
2019-10-08 12:38                             ` Michael Heerdegen
2019-10-08 13:03                               ` Eli Zaretskii
2019-10-09 14:47                                 ` Michael Heerdegen
2019-10-09 15:33                                   ` Eli Zaretskii
2019-10-09 20:53                                     ` Paul Eggert
2019-10-10 10:58                                     ` Michael Heerdegen
2019-10-08  9:22                       ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d98f0762-d3ff-90e7-07ad-2b081b0aed29@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=37321@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).