[Top][All Lists]

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

Re: GC

From: Adrian Aichner
Subject: Re: GC
Date: Sun, 26 Jun 2005 10:20:52 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b20 (cilantro, windows-nt)

Miles Bader <address@hidden> writes:

> On 6/26/05, Adrian Aichner <address@hidden> wrote:
>> >> isn't that the purpose of
>> >> gc-cons-percentage
>> >
>> > There is no such variable in Emacs.
>> Oh, so it's a XEmacs-only thing.
> OK; guess if we add this feature, we should use the same variable
> name though.
> As Gaëtan Leurent pointed out, it's also a good idea to apply min/max
> bounds to the calculated value, to handle extreme cases; what does
> xemacs do about that?

Oops, this feature not currently enabled in XEmacs!

See recompute_need_to_garbage_collect in alloc.c.

Here is its documentation from the trunk version of alloc.c anyway:

  DEFVAR_INT ("gc-cons-percentage", &gc_cons_percentage /*
*Percentage of memory allocated between garbage collections.

Garbage collection will happen if this percentage of the total amount of
memory used for data has been allocated since the last garbage collection.
However, it will not happen if less than `gc-cons-threshold' bytes have
been allocated -- this sets an absolute minimum in case very little data
has been allocated or the percentage is set very low.  Set this to 0 to
have garbage collection always happen after `gc-cons-threshold' bytes have
been allocated, regardless of current memory usage.

Garbage collection happens automatically when `eval' or `funcall' are
called.  (Note that `funcall' is called implicitly as part of evaluation.)
By binding this temporarily to a large number, you can effectively
prevent garbage collection during a part of the program.

See also `consing-since-gc'.
*/ );

So, gc-cons-threshold serves as the lower bound, and
gc-cons-percentage itself is the upper.


> [I'm thinking a minimum of say the current default (400K), and a max
> of oh, 8MB.]
> -Miles

Adrian Aichner

reply via email to

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