emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opportunistic garbage collection


From: Paul Eggert
Subject: Re: Opportunistic garbage collection
Date: Wed, 24 Apr 2019 17:17:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

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 via email to

[Prev in Thread] Current Thread [Next in Thread]