From: Eli Zaretskii <eliz@gnu.org>
To: Joseph Mingrone <jrm@ftfl.ca>, Paul Eggert <eggert@cs.ucla.edu>
Cc: mattiase@acm.org, 37006@debbugs.gnu.org
Subject: bug#37006: 27.0.50; garbage collection not happening after 26de2d42
Date: Mon, 12 Aug 2019 19:49:43 +0300 [thread overview]
Message-ID: <83wofis508.fsf@gnu.org> (raw)
In-Reply-To: <868srysb9x.fsf@phe.ftfl.ca> (message from Joseph Mingrone on Mon, 12 Aug 2019 11:34:18 -0300)
> From: Joseph Mingrone <jrm@ftfl.ca>
> Cc: mattiase@acm.org, eggert@cs.ucla.edu, 37006@debbugs.gnu.org
> Date: Mon, 12 Aug 2019 11:34:18 -0300
>
> The fix did not initially work for me. I tested a bit more. With
>
> 1. emacs -Q
> 2. (setq garbage-collection-messages t)
> 3. page through xdisp.c
>
> I saw lots of garbage collection messages. But, with my init.el there
> were no such messages. My init.el looked like this.
>
> ----------------------------------------------------
> (setq gc-cons-threshold most-positive-fixnum)
>
> ;; contents of init.el here
>
> (setq gc-cons-threshold 800000) ;; default value
> ----------------------------------------------------
>
> When I removed the surrounding setqs, garbage collection message were
> shown again when paging through xdisp.c.
>
> I assume that temporarily setting `gc-cons-threshold' to a large number
> to temporarily prevent garbage collection, then setting it back to a
> reasonable value should be acceptable.
Yes, of course. There's a separate bug in the recent GC-related
changes. Thanks for pointing this out.
Paul, the current method of updating consing_until_gc only in
garbage_collect_1 isn't workable, because it doesn't support the (very
popular nowadays) paradigm of temporarily setting gc-cons-threshold
very high: doing so avoids calling garbage_collect_1, and thus the
change of the threshold back to a lower value is never seen. We must
have something in maybe_gc to notice the change and recompute the
threshold. We must also notice the memory-full condition there.
We need to fix this ASAP, please.
I also don't think I understand the details of the threshold
calculations:
if (!NILP (Vmemory_full))
consing_until_gc = memory_full_cons_threshold;
else
{
intptr_t threshold = min (max (GC_DEFAULT_THRESHOLD,
gc_cons_threshold >> 3),
OBJECT_CT_MAX);
if (FLOATP (Vgc_cons_percentage))
{
double tot = (XFLOAT_DATA (Vgc_cons_percentage)
* total_bytes_of_live_objects ());
if (threshold < tot)
{
if (tot < OBJECT_CT_MAX)
threshold = tot;
else
threshold = OBJECT_CT_MAX;
}
}
consing_until_gc = threshold;
}
First, gc_cons_threshold is an EMACS_INT, so putting its value into
intptr_t is wrong in 32-bit builds --with-wide-int, right? For the
same reason, using intptr_t for OBJECT_CT_MAX is wrong in such a
build.
And second, why does the code divide gc_cons_threshold by 8? If the
value of gc_cons_threshold is most-positive-fixnum, that is wrong, I
think. Did you mean to divide GC_DEFAULT_THRESHOLD instead?
next prev parent reply other threads:[~2019-08-12 16:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5075406D-6DB8-4560-BB64-7198526FCF9F@acm.org>
2019-08-11 16:23 ` bug#37006: 27.0.50; garbage collection not happening after 26de2d42 Mattias Engdegård
2019-08-11 17:07 ` Eli Zaretskii
[not found] ` <83h86nu0pq.fsf@gnu.org>
[not found] ` <86pnlbphus.fsf@phe.ftfl.ca>
2019-08-12 2:31 ` Eli Zaretskii
2019-08-12 14:34 ` Joseph Mingrone
2019-08-12 16:49 ` Eli Zaretskii [this message]
2019-08-12 17:00 ` Mattias Engdegård
2019-08-13 15:37 ` Eli Zaretskii
2019-08-13 16:48 ` Mattias Engdegård
2019-08-13 17:04 ` Eli Zaretskii
2019-08-13 17:29 ` Mattias Engdegård
2019-08-13 17:21 ` Paul Eggert
2019-08-13 17:53 ` Eli Zaretskii
2019-08-13 19:32 ` Paul Eggert
2019-08-14 16:06 ` Eli Zaretskii
2019-08-15 1:37 ` Paul Eggert
2019-08-15 14:17 ` Eli Zaretskii
2019-08-15 18:51 ` Paul Eggert
2019-08-15 19:34 ` Eli Zaretskii
2019-09-14 7:51 ` Paul Eggert
2019-09-14 8:30 ` Eli Zaretskii
2019-08-11 12:39 Joseph Mingrone
2019-08-11 15:13 ` 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=83wofis508.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=37006@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=jrm@ftfl.ca \
--cc=mattiase@acm.org \
/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.