GNU bug report logs -
#37006
27.0.50; garbage collection not happening after 26de2d42
Previous Next
Reported by: Joseph Mingrone <jrm <at> ftfl.ca>
Date: Sun, 11 Aug 2019 12:41:01 UTC
Severity: normal
Tags: patch
Found in version 27.0.50
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #58 received at 37006 <at> debbugs.gnu.org (full text, mbox):
> Cc: jrm <at> ftfl.ca, mattiase <at> acm.org, 37006 <at> debbugs.gnu.org
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Wed, 14 Aug 2019 18:37:44 -0700
>
> > However, I'd rather we don't invent new data types unless really
> > necessary.
>
> I did that yesterday, in commit 2019-08-13T19:20:40Z!eggert <at> cs.ucla.edu
> (b80559be212292d44ce14ca5e94505cab4d9a868).
OK, but I still hope we will switch to EMACS_INT instead.
> > gc-cons-threshold is a Lisp integer, a
> > fixnum, so it cannot exceed EMACS_INT_MAX, I think.
>
> No, (setq gc-cons-threshold (1+ most-positive-fixnum)) works and does the right
> thing.
That makes gc-cons-threshold a bignum, right? I don't see why we
should support such large values of the threshold, we never did
before. most-positive-fixnum on 32-bit systems is large enough for
every practical purpose. Also, supporting the full 32 bits (and 64
bits in 64-bit builds) will also allow contradictory situation whereby
gc-cons-threshold is higher than what we say should be used to disable
GC.
> The variable's value can be any intmax_t value. This is useful for
> quantities like GC object byte counts that might not fit into fixnums.
Why do we need to talk about how many objects are there? GC threshold
is not about counting objects, it's about deciding when to GC.
> > Can we use for this purpose the existing trapped_write
> > field of Lisp_Symbol that is the base for implementing Lisp watcher
> > functions?
>
> Don't see why not.
Are you working on that, or should someone else do it?
> > With the old code, whenever memory-full was non-nil, and
> > consing_since_gc was more than the size of cons_block (about 1KB on my
> > system), the very next maybe_gc call would actually trigger GC. With
> > the new code, no matter how much consing happened before memory-full
> > became non-nil, we still need to cons 1KB worth of objects before GC
> > happens. This 1KB might be critical when we are out of memory.
>
> I don't think the scenario is worth worrying about doing a GC now rather than
> later. But if we go the trapped_write route, this issue won't matter since the
> GC will be done quickly.
I don't think I understand how trapped writes could help in the case
of memory-full, since that situation happens independently of setting
the value of gc-cons-threshold.
> >> Immediate-GC might cause GC thrashing, no?
> >
> > Not sure how, can you elaborate?
>
> When EMacs is low on memory, if we're not careful Emacs could GC every time
> maybe_gc is called, which will be roughly equivalent to Emacs hanging and doing
> nothing.
Right, but that's not what I proposed. I proposed to trigger an
immediate GC only the first time we detect memory-full. Thereafter,
the threshold will be set to 1KB, which should prevent thrashing.
This bug report was last modified 5 years and 246 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.