From: Paul Eggert <eggert@cs.ucla.edu>
To: Joseph Mingrone <jrm@ftfl.ca>
Cc: "Mattias Engdegård" <mattiase@acm.org>,
37006@debbugs.gnu.org, Akater <nuclearspace@gmail.com>
Subject: bug#37006: Emacs 27 master consumes more memory than 26 and freezes regularly
Date: Thu, 5 Sep 2019 13:30:18 -0700 [thread overview]
Message-ID: <6e982f57-2755-b746-d0de-c73ebcfcd6ac@cs.ucla.edu> (raw)
In-Reply-To: <e532a3e1-d501-74ac-8acc-a2f264c4ac5f@cs.ucla.edu>
[-- Attachment #1: Type: text/plain, Size: 100 bytes --]
I reproduced the problem on Fedora 30 x86-64 and installed the attached
fix. Please give it a try.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-bugs-when-recalculating-consing_until_gc.patch --]
[-- Type: text/x-patch; name="0001-Fix-bugs-when-recalculating-consing_until_gc.patch", Size: 2948 bytes --]
From 2c246fde5ebe76bf48322c09fd685e48c0737f2a Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 5 Sep 2019 13:25:43 -0700
Subject: [PATCH] Fix bugs when recalculating consing_until_gc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Problem reported by Joseph Mingrone (Bug#37006#72).
* src/alloc.c (watch_gc_cons_threshold)
(watch_gc_cons_percentage):
Don’t try to store an intmax_t into an int.
Redo to make the code clearer.
(watch_gc_cons_percentage):
Use gc_cons_threshold, not consing_until_gc.
---
src/alloc.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 089f61f833..5fc515f33b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5783,18 +5783,18 @@ mark_and_sweep_weak_table_contents (void)
/* Return the number of bytes to cons between GCs, assuming
gc-cons-threshold is THRESHOLD and gc-cons-percentage is
- GC_CONS_PERCENTAGE. */
+ PERCENTAGE. */
static intmax_t
-consing_threshold (intmax_t threshold, Lisp_Object gc_cons_percentage)
+consing_threshold (intmax_t threshold, Lisp_Object percentage)
{
if (!NILP (Vmemory_full))
return memory_full_cons_threshold;
else
{
threshold = max (threshold, GC_DEFAULT_THRESHOLD / 10);
- if (FLOATP (gc_cons_percentage))
+ if (FLOATP (percentage))
{
- double tot = (XFLOAT_DATA (gc_cons_percentage)
+ double tot = (XFLOAT_DATA (percentage)
* total_bytes_of_live_objects ());
if (threshold < tot)
{
@@ -5825,11 +5825,12 @@ bump_consing_until_gc (intmax_t diff)
watch_gc_cons_threshold (Lisp_Object symbol, Lisp_Object newval,
Lisp_Object operation, Lisp_Object where)
{
- intmax_t new_threshold;
- int diff = (INTEGERP (newval) && integer_to_intmax (newval, &new_threshold)
- ? (consing_threshold (new_threshold, Vgc_cons_percentage)
- - consing_threshold (gc_cons_threshold, Vgc_cons_percentage))
- : 0);
+ Lisp_Object percentage = Vgc_cons_percentage;
+ intmax_t threshold;
+ intmax_t diff = (INTEGERP (newval) && integer_to_intmax (newval, &threshold)
+ ? (consing_threshold (threshold, percentage)
+ - consing_threshold (gc_cons_threshold, percentage))
+ : 0);
return bump_consing_until_gc (diff);
}
@@ -5838,8 +5839,9 @@ watch_gc_cons_threshold (Lisp_Object symbol, Lisp_Object newval,
watch_gc_cons_percentage (Lisp_Object symbol, Lisp_Object newval,
Lisp_Object operation, Lisp_Object where)
{
- int diff = (consing_threshold (consing_until_gc, newval)
- - consing_threshold (consing_until_gc, Vgc_cons_percentage));
+ intmax_t threshold = gc_cons_threshold;
+ intmax_t diff = (consing_threshold (threshold, newval)
+ - consing_threshold (threshold, Vgc_cons_percentage));
return bump_consing_until_gc (diff);
}
--
2.21.0
next prev parent reply other threads:[~2019-09-05 20:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-31 15:46 Emacs 27 master consumes more memory than 26 and freezes regularly Akater
2019-08-31 16:30 ` Eli Zaretskii
2019-08-31 19:24 ` Paul Eggert
2019-09-03 20:11 ` bug#37006: " Paul Eggert
2019-09-05 16:12 ` Joseph Mingrone
2019-09-05 17:01 ` Paul Eggert
2019-09-05 17:06 ` Joseph Mingrone
2019-09-05 20:30 ` Paul Eggert [this message]
2019-09-05 21:28 ` Joseph Mingrone
2019-09-05 21:34 ` Paul Eggert
2019-09-06 7:03 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6e982f57-2755-b746-d0de-c73ebcfcd6ac@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=37006@debbugs.gnu.org \
--cc=jrm@ftfl.ca \
--cc=mattiase@acm.org \
--cc=nuclearspace@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.