unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: Opportunistic garbage collection
Date: Wed, 24 Apr 2019 17:17:45 -0700	[thread overview]
Message-ID: <b2bab9ee-ba8f-a936-3b07-1de293e72eda@cs.ucla.edu> (raw)
In-Reply-To: <jwvwojj9lou.fsf-monnier+emacs@gnu.org>

That sounds like a good idea. Some minor points:

On 4/24/19 1:54 PM, Stefan Monnier wrote:
> +needed to triger automatic allocation took place.  */)

triger -> trigger

> +  (Lisp_Object factor)

Instead of having a factor argument, how about hardwiring in a factor of
2? We can always generalize it later, and maybe we'll never need to
generalize it.

> +  byte_ct new_csgc = consing_since_gc * fact;
> +  if (new_csgc / fact != consing_since_gc)
> +    /* Overflow!  */
> +    garbage_collect ();

This assumes byte_ct is not narrower than EMACS_INT, which isn't true on
32-bit platforms --with-wide-int. It also assumes 'fact' is nonzero,
which might not be true. (Two more reasons to hardwire 2.)

> +      consing_since_gc = new_csgc;
> +      maybe_gc ();
> +      consing_since_gc /= fact;
>
I'd feel better if we didn't muck with the global variable and passed
the smaller consing value directly to a variant of maybe_gc.

>  
>        /* If there is still no input available, ask for GC.  */
>        if (!detect_input_pending_run_timers (0))
> -	maybe_gc ();
> +	maybe_gc (); /* FIXME: Why?  */
>      }
If we don't know why, let's get rid of it....



  reply	other threads:[~2019-04-25  0:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 20:54 Opportunistic garbage collection Stefan Monnier
2019-04-25  0:17 ` Paul Eggert [this message]
2019-04-25  6:27   ` Eli Zaretskii
2019-04-25 12:49     ` Stefan Monnier
2019-04-25 18:18   ` Stefan Monnier
2019-04-25 22:14     ` Paul Eggert
2019-04-26  0:15       ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2bab9ee-ba8f-a936-3b07-1de293e72eda@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).