diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-09-14 00:32:01 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-09-14 00:37:26 -0700 |
commit | bac66302e92bdd3a353102d2076548e7e83d92e5 (patch) | |
tree | 6007fc144e41b0a0f0eb43bf11100eb4ce8085d4 /lib-src/emacsclient.c | |
parent | e4fb98b542c57fa4856fbeb14230ace34d910117 (diff) | |
download | emacs-bac66302e92bdd3a353102d2076548e7e83d92e5.tar.gz emacs-bac66302e92bdd3a353102d2076548e7e83d92e5.tar.bz2 emacs-bac66302e92bdd3a353102d2076548e7e83d92e5.zip |
Improve gc-cons-percentage calculation
The old calculation relied on a hodgpodge of partly updated GC
stats to find a number to multiply gc-cons-percentage by.
The new one counts data found by the previous GC, plus half of
the data allocated since then; this is more systematic albeit
still ad hoc.
* src/alloc.c (consing_until_gc, gc_threshold, consing_threshold):
Now EMACS_INT, not intmax_t.
(HI_THRESHOLD): New macro.
(tally_consing): New function.
(make_interval, allocate_string, allocate_string_data)
(make_float, free_cons, allocate_vectorlike, Fmake_symbol): Use it.
(allow_garbage_collection, inhibit_garbage_collection)
(consing_threshold, garbage_collect):
Use HI_THRESHOLD rather than INTMAX_MAX.
(consing_threshold): New arg SINCE_GC. All callers changed.
(bump_consing_until_gc): Return new consing_until_gc, instead of
nil. All callers changed. Don’t worry about overflow since we
now saturate at HI_THRESHOLD. Guess that half of
recently-allocated objects are still alive, instead of relying on
the previous (even less-accurate) hodgepodge.
(maybe_garbage_collect): New function.
(garbage_collect): Work even if a finalizer disables or enables
memory profiling. Do not use malloc_probe if GC reclaimed nothing.
* src/lisp.h (maybe_gc): Call maybe_garbage_collect instead
of garbage_collect.
Diffstat (limited to 'lib-src/emacsclient.c')
0 files changed, 0 insertions, 0 deletions