[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Eager garbage collection
From: |
Spencer Baugh |
Subject: |
Re: Eager garbage collection |
Date: |
Wed, 18 Nov 2020 10:19:26 -0500 |
Andrea Corallo <akrl@sdf.org> writes:
> My question is, what is the advantage of this implementation respect the
> pure Lisp one we have?
>
> <https://gitlab.com/koral/gcmh/-/blob/master/gcmh.el>
>
> AFAIU they achieve the same. If that's the case I indeed prefer the
> Lisp one as simpler and easier to extend.
The core necessary thing that requires C changes is making a garbage
collection function which "maybe" does a garbage collect.
gcmh.el always does a full garbage collection when idle, even if there's
no garbage. That will hurt responsiveness, especially with a very large
heap (as gcmh configures), because GC takes time proportional to the
size of the heap, not the amount of garbage.
Possibly, we could rely on the fact that maybe_gc gets called
automatically as part of Lisp evaluation. Then we'd just want to ensure
that GC happens eagerly, which we could do by lowering gc-cons-threshold
while idle. But that's excessively magical, I would say.
Although, I suppose we could just expose consing_until_gc, or some other
variable, to Lisp. Then the eager maybe-GC logic could be in Lisp:
Recalculate a local consing_until_gc and decide whether or not to call
garbage-collect based on that, just like the C code does. It would
duplicate some logic between Lisp and C, but maybe that's ok.
If others think that's a good idea, I can change to just exposing
consing_until_gc.
- Re: Eager garbage collection, (continued)
- Re: Eager garbage collection, Andrea Corallo, 2020/11/18
- Re: Eager garbage collection, Eli Zaretskii, 2020/11/18
- Re: Eager garbage collection, Andrea Corallo, 2020/11/18
- Re: Eager garbage collection, Eli Zaretskii, 2020/11/18
- Re: Eager garbage collection, Andrea Corallo, 2020/11/18
- Re: Eager garbage collection, Eli Zaretskii, 2020/11/18
- Re: Eager garbage collection, Andrea Corallo, 2020/11/18
- Re: Eager garbage collection,
Spencer Baugh <=
- Re: Eager garbage collection, Andrea Corallo, 2020/11/18
- Re: Eager garbage collection, Stefan Monnier, 2020/11/18
- Re: Eager garbage collection, Andrea Corallo, 2020/11/18
- Re: Eager garbage collection, Eli Zaretskii, 2020/11/18
- Re: Eager garbage collection, Eli Zaretskii, 2020/11/18
- Re: Eager garbage collection, Spencer Baugh, 2020/11/22
- [PATCH v2 1/3] Add gc-estimated-time variable, Spencer Baugh, 2020/11/22
- Re: [PATCH v2 1/3] Add gc-estimated-time variable, Eli Zaretskii, 2020/11/22
- Re: [PATCH v2 1/3] Add gc-estimated-time variable, Stefan Monnier, 2020/11/22
- [PATCH v2 2/3] Add garbage-collect-maybe function, Spencer Baugh, 2020/11/22