[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Larger GC thresholds for non-interactive Emacs
From: |
Ihor Radchenko |
Subject: |
Re: Larger GC thresholds for non-interactive Emacs |
Date: |
Sat, 18 Jun 2022 13:35:04 +0800 |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> BTW, I seen everyone's focused on `gc-cons-threshold` but that variable
> does not adapt to the heap size, so maybe we'd be better off
> playing with `gc-cons-percentage`.
I am not sure if `gc-cons-percentage' is reliable.
When we have a small heap (at the beginning of the batch command run),
the GC will be triggered frequently. Later, after initial memory
allocations for data structures is complete, the same
`gc-cons-percentage' will make GC fire less frequently and will have
nothing to do with actually allocated/deallocated memory objects in the
subsequent parts of the batch process.
Consider the following example:
(defun init () (allocate-huge-hash-map-object))
(defun run () (dolist (...) (let (this and that) (query the huge hash-map))))
(init)
(run)
The (init) part will trigger frequent GCs yielding no of very small
amount of garbage being collected.
The (run) part may use more temporary allocations. Yet, GC will be
triggered much less frequently simply because the atomic (let ...)
allocations are small compared to the initially allocated hash-map
object.
I believe that gc-cons-threshold will still be useful as _an upper
bound_ to trigger GC. gc-cons-percentage is probably more efficient when
it triggers below gc-cons-threshold.
Best,
Ihor
- Re: Org mode and Emacs (was: Convert README.org to plain text README while installing package), (continued)
- Re: Org mode and Emacs (was: Convert README.org to plain text README while installing package), Eli Zaretskii, 2022/06/16
- Re: Org mode and Emacs (was: Convert README.org to plain text README while installing package), Mattias EngdegÄrd, 2022/06/16
- Re: Org mode and Emacs (was: Convert README.org to plain text README while installing package), Ihor Radchenko, 2022/06/16
- Re: Org mode and Emacs, Stefan Monnier, 2022/06/16
- Larger GC thresholds for non-interactive Emacs (was: Org mode and Emacs), Ihor Radchenko, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Stefan Monnier, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Lars Ingebrigtsen, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Lars Ingebrigtsen, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Stefan Monnier, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Lars Ingebrigtsen, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs,
Ihor Radchenko <=
- Re: Larger GC thresholds for non-interactive Emacs, Stefan Monnier, 2022/06/18
- Re: Larger GC thresholds for non-interactive Emacs, Stefan Monnier, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Lars Ingebrigtsen, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Alan Mackenzie, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Stefan Monnier, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Lars Ingebrigtsen, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Stefan Monnier, 2022/06/17
- Re: Larger GC thresholds for non-interactive Emacs, Eli Zaretskii, 2022/06/18
- Re: Larger GC thresholds for non-interactive Emacs, Lars Ingebrigtsen, 2022/06/18
- Re: Larger GC thresholds for non-interactive Emacs, Stefan Monnier, 2022/06/18